Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
platform
active.directory
adsi
adsi.iis-admin
base
com_ole
complus_mts
component_svcs
database
directx
gdi
graphics_mm
internet.client
internet.server
internet.server.isapi-dev
localization
mapi
messaging
msi
mslayerforunicode
multimedia
networking
networking.ipv6
sdk_install
security
shell
telephony.tapi_2
telephony.tapi_3
telephony.tsp
telephony.wte
tools
ui
ui_shell
win_base_svcs
win16
  
 
date: Wed, 30 Jul 2008 02:13:40 +0800,    group: microsoft.public.platformsdk.mapi        back       


Configuring IMAP with ConfigureMsgService API...   
I am trying to add a new service and configure it. Its an IMAP service that 
I add first and can see it on my outlook. However, I run into problems when 
I try configuring this.

The ConfigureMsgService returns an S_OK but I don't find the service 
configured.

 
And then the configuremsgservice returns S_OK but the service is not 
configured.
 
Am I missing something??
 
Please help

[CODE]

LPPROFSECT lpPSGlobal = NULL;
                //hRes = lpMAPISession->OpenProfileSection((LPMAPIUID)
pbGlobalProfileSectionGuid, NULL, 0, &lpPSGlobal);
                IMsgServiceAdmin* pMsgAdmin = NULL;
                hRes = lpMAPISession->AdminServices(0,&pMsgAdmin);
                IMAPITable* lppTable = NULL;
                LPMAPIERROR* lppError = NULL;
                
                if (hRes == S_OK)
                {
                        //hRes = pMsgAdmin->GetMsgServiceTable(0,&lppTable)
;
                        //pMsgAdmin->GetLastError(hRes,MAPI_UNICODE,lppError)
;
                        //hRes = pMsgAdmin->GetProviderTable(0,&lppTable);
                        //pMsgAdmin->GetLastError(hRes,MAPI_UNICODE,lppError)
;
                        char *str  = "INTERSTOR";
                        char* strStoreName = "Test service";
                        //hRes = pMsgAdmin->CreateMsgService((LPTSTR)str,
(LPTSTR)strStoreName,0,0);
                        //if (hRes == MAPI_E_NOT_FOUND)
                        //      MessageBox(L"Your MAPISVC.INF file is not 
configured to create an IMAP service",L"Error",MB_OK);
 
                        if (FAILED(hRes = pMsgAdmin->GetMsgServiceTable(0, 
// Flags.
                                                                             
                                           &lppTable))) // Pointer to table.

                        {       
                                MessageBox(L"Error getting Message Service 
Table.",L"Error",MB_OK);
                                
                        }
                        enum {iSvcName, iSvcUID, cptaSvc};
                        SRestriction sres; // Restriction structure.
                        SPropValue SvcProps; // Property structure for 
restriction.
                        SizedSPropTagArray(cptaSvc,sptCols) = { cptaSvc, 
PR_SERVICE_NAME, PR_SERVICE_UID };
                        //SizedSPropTagArray(1, sptCols) =
                        //{
                        //      1,
                        //      {PR_SERVICE_UID}
                        //};
 
                        //lppTable->SetColumns((LPSPropTagArray)&sptCols,
TBL_BATCH);
                        // LPSRowSet* lpRowSet = 0;
 
                        //lppTable->QueryRows(1,0,lpRowSet);
 
                        LPSRowSet lpSvcRows = NULL; // Rowset to hold 
results of table query.
                        
                        sres.rt = RES_CONTENT;
                        sres.res.resContent.ulFuzzyLevel = FL_SUBSTRING;
                        sres.res.resContent.ulPropTag = PR_SERVICE_NAME;
                        sres.res.resContent.lpProp = &SvcProps;
 
                        SvcProps.ulPropTag = PR_SERVICE_NAME;
                        SvcProps.Value.lpszW = L"INTERSTOR";
 
                        if (FAILED(hRes = HrQueryAllRows(lppTable,
                                                                             
                   (LPSPropTagArray)&sptCols,
                                                                             
                   &sres,
                                                                             
                   NULL,
                                                                             
                   0,
                                                                             
                   &lpSvcRows)))
                        {
                                MessageBox(L"Error querying table for new 
message Service ",L"Error",MB_OK);
                        }
                        SPropValue rgval[3]; // Property structure to hold 
values we want to set.
                        LPMAPIUID lpMyServiceUID = (LPMAPIUID)
lpSvcRows->aRow->lpProps[iSvcUID].Value.bin.lpb;
                        Sleep(1);
                        /*Configure the service now*/
                        
                        // First, the server name.
                        ZeroMemory((char*)&rgval[1], sizeof(SPropValue) );
                        rgval[1].ulPropTag = PR_PROFILE_UNRESOLVED_SERVER;
                        char* szServer = "uk-stage.test.com";
                        rgval[1].Value.lpszA = (char*)szServer;
 
                        // Next, the mailbox name.
                        ZeroMemory((char*)&rgval[0], sizeof(SPropValue) );
                        rgval[0].ulPropTag = PR_PROFILE_UNRESOLVED_NAME;
                        char* szMailbox = "test@testfeed.co.uk";
                        rgval[0].Value.lpszA = (char*)szMailbox;
        
                        ZeroMemory((char*)&rgval[2], sizeof(SPropValue) );
                        rgval[0].ulPropTag = PR_PROFILE_OFFLINE_STORE_PATH;
                        char* szPstpath = "C:\\Test.pst";
                        rgval[0].Value.lpszA = (char*)szPstpath;
 
                        // Configure the message service with the above 
properties.
 
                        if (FAILED(hRes = pMsgAdmin->ConfigureMsgService(
                                (LPMAPIUID)lpSvcRows->aRow->lpProps[iSvcUID].
Value.bin.lpb, // Entry ID of service to configure.
                                NULL, // Handle to parent window.
                                0, // Flags.
                                2, // Number of properties we are setting.
                                rgval))) // Pointer to SPropValue array.
                        {
                                Log(true,L"Failed to ConfigureMsgService");
 
                        }
[/CODE]

url:http://www.ureader.com/gp/1651-1.aspx
date: Wed, 30 Jul 2008 02:13:40 +0800   author:   exchange nerd

Re: Configuring IMAP with ConfigureMsgService API...   
AFAIK IMAP service is not MAPI based, and hence cannot be configured using 
IMsgServiceAdmin.
"INTERSTOP" is just the store part, which is nothing more than a PST.

-- 
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool
-
"exchange nerd"  wrote in message 
news:51dc4e00e11644bcbaa1f37d505a7905@newspe.com...
>I am trying to add a new service and configure it. Its an IMAP service that
> I add first and can see it on my outlook. However, I run into problems 
> when
> I try configuring this.
>
> The ConfigureMsgService returns an S_OK but I don't find the service
> configured.
>
>
> And then the configuremsgservice returns S_OK but the service is not
> configured.
>
> Am I missing something??
>
> Please help
>
> [CODE]
>
> LPPROFSECT lpPSGlobal = NULL;
>                //hRes = lpMAPISession->OpenProfileSection((LPMAPIUID)
> pbGlobalProfileSectionGuid, NULL, 0, &lpPSGlobal);
>                IMsgServiceAdmin* pMsgAdmin = NULL;
>                hRes = lpMAPISession->AdminServices(0,&pMsgAdmin);
>                IMAPITable* lppTable = NULL;
>                LPMAPIERROR* lppError = NULL;
>
>                if (hRes == S_OK)
>                {
>                        //hRes = pMsgAdmin->GetMsgServiceTable(0,&lppTable)
> ;
> 
> //pMsgAdmin->GetLastError(hRes,MAPI_UNICODE,lppError)
> ;
>                        //hRes = pMsgAdmin->GetProviderTable(0,&lppTable);
> 
> //pMsgAdmin->GetLastError(hRes,MAPI_UNICODE,lppError)
> ;
>                        char *str  = "INTERSTOR";
>                        char* strStoreName = "Test service";
>                        //hRes = pMsgAdmin->CreateMsgService((LPTSTR)str,
> (LPTSTR)strStoreName,0,0);
>                        //if (hRes == MAPI_E_NOT_FOUND)
>                        //      MessageBox(L"Your MAPISVC.INF file is not
> configured to create an IMAP service",L"Error",MB_OK);
>
>                        if (FAILED(hRes = pMsgAdmin->GetMsgServiceTable(0,
> // Flags.
>
>                                           &lppTable))) // Pointer to 
> table.
>
>                        {
>                                MessageBox(L"Error getting Message Service
> Table.",L"Error",MB_OK);
>
>                        }
>                        enum {iSvcName, iSvcUID, cptaSvc};
>                        SRestriction sres; // Restriction structure.
>                        SPropValue SvcProps; // Property structure for
> restriction.
>                        SizedSPropTagArray(cptaSvc,sptCols) = { cptaSvc,
> PR_SERVICE_NAME, PR_SERVICE_UID };
>                        //SizedSPropTagArray(1, sptCols) =
>                        //{
>                        //      1,
>                        //      {PR_SERVICE_UID}
>                        //};
>
>                        //lppTable->SetColumns((LPSPropTagArray)&sptCols,
> TBL_BATCH);
>                        // LPSRowSet* lpRowSet = 0;
>
>                        //lppTable->QueryRows(1,0,lpRowSet);
>
>                        LPSRowSet lpSvcRows = NULL; // Rowset to hold
> results of table query.
>
>                        sres.rt = RES_CONTENT;
>                        sres.res.resContent.ulFuzzyLevel = FL_SUBSTRING;
>                        sres.res.resContent.ulPropTag = PR_SERVICE_NAME;
>                        sres.res.resContent.lpProp = &SvcProps;
>
>                        SvcProps.ulPropTag = PR_SERVICE_NAME;
>                        SvcProps.Value.lpszW = L"INTERSTOR";
>
>                        if (FAILED(hRes = HrQueryAllRows(lppTable,
>
>                   (LPSPropTagArray)&sptCols,
>
>                   &sres,
>
>                   NULL,
>
>                   0,
>
>                   &lpSvcRows)))
>                        {
>                                MessageBox(L"Error querying table for new
> message Service ",L"Error",MB_OK);
>                        }
>                        SPropValue rgval[3]; // Property structure to hold
> values we want to set.
>                        LPMAPIUID lpMyServiceUID = (LPMAPIUID)
> lpSvcRows->aRow->lpProps[iSvcUID].Value.bin.lpb;
>                        Sleep(1);
>                        /*Configure the service now*/
>
>                        // First, the server name.
>                        ZeroMemory((char*)&rgval[1], sizeof(SPropValue) );
>                        rgval[1].ulPropTag = PR_PROFILE_UNRESOLVED_SERVER;
>                        char* szServer = "uk-stage.test.com";
>                        rgval[1].Value.lpszA = (char*)szServer;
>
>                        // Next, the mailbox name.
>                        ZeroMemory((char*)&rgval[0], sizeof(SPropValue) );
>                        rgval[0].ulPropTag = PR_PROFILE_UNRESOLVED_NAME;
>                        char* szMailbox = "test@testfeed.co.uk";
>                        rgval[0].Value.lpszA = (char*)szMailbox;
>
>                        ZeroMemory((char*)&rgval[2], sizeof(SPropValue) );
>                        rgval[0].ulPropTag = PR_PROFILE_OFFLINE_STORE_PATH;
>                        char* szPstpath = "C:\\Test.pst";
>                        rgval[0].Value.lpszA = (char*)szPstpath;
>
>                        // Configure the message service with the above
> properties.
>
>                        if (FAILED(hRes = pMsgAdmin->ConfigureMsgService(
> 
> (LPMAPIUID)lpSvcRows->aRow->lpProps[iSvcUID].
> Value.bin.lpb, // Entry ID of service to configure.
>                                NULL, // Handle to parent window.
>                                0, // Flags.
>                                2, // Number of properties we are setting.
>                                rgval))) // Pointer to SPropValue array.
>                        {
>                                Log(true,L"Failed to ConfigureMsgService");
>
>                        }
> [/CODE]
>
> url:http://www.ureader.com/gp/1651-1.aspx
date: Wed, 30 Jul 2008 09:41:29 -0700   author:   Dmitry Streblechenko

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us