Setting an IMAP4 account as the default store



Hi

I need to set my IMAP4 account as the default store. Can anyone4 help me in this regard?

Here is my code -


HRESULT hRes = S_OK;
IMsgServiceAdmin* pMsgAdmin = NULL;
IMAPITable* lppTable = NULL;
LPMAPIERROR* lppError = NULL;

try
{
if (FAILED(hRes = m_lpMAPISession->AdminServices(0,&pMsgAdmin)) )
{
Log(true,L"Error getting Admin service Table.");
return hRes;
}

if (FAILED(hRes = pMsgAdmin->GetMsgServiceTable(0, // Flags.
&lppTable))) // Pointer to table.
{
Log(true,L"Error getting Message Service Table.");
return hRes;
}

enum {iEntID,iSvcName, iSvcUID, cptaSvc};
SRestriction sres; // Restriction structure.
SPropValue SvcProps; // Property structure for restriction.

LPSRowSet lpSvcRows = NULL; // Rowset to hold results of table query.
//SizedSPropTagArray(cptaSvc,sptCols) = { cptaSvc, PR_ENTRYID,PR_SERVICE_NAME, PR_SERVICE_UID,PR_DISPLAY_NAME_W};
SizedSPropTagArray(cptaSvc,sptCols) = { cptaSvc, PR_ENTRYID,PR_SERVICE_NAME, PR_SERVICE_UID };
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";
//lppTable->FindRow()
if (FAILED(hRes = HrQueryAllRows(lppTable,
(LPSPropTagArray)&sptCols,
&sres,
NULL,
0,
&lpSvcRows)))
{
Log(true,L"Error querying table for new message Service ");
return hRes;
}

//LPMAPIUID lpMyServiceUID = (LPMAPIUID)lpSvcRows->aRow->lpProps[iSvcUID].Value.bin.lpb;
LPENTRYID lpEntryID = (LPENTRYID)lpSvcRows->aRow->lpProps[iEntID].Value.bin.lpb;
if (FAILED (hRes = m_lpMAPISession->SetDefaultStore(MAPI_DEFAULT_STORE ,16,lpEntryID)) )
{
Log(true,L"Failed to SetDefaultStore %08x",hRes);
return hRes;
}


THe LPENTRYID seems to be invalid.
--
Cheers,
Raj
.



Relevant Pages

  • Re: Setting IMAP a/c as the default store
    ... OutlookSpy - Outlook, CDO ... LPMAPIERROR* lppError = NULL; ... return hRes; ... Log(true,L"Error querying table for new message Service "); ...
    (microsoft.public.win32.programmer.messaging)
  • Setting IMAP a/c as the default store
    ... HRESULT hRes = S_OK; ... SRestriction sres; // Restriction structure. ... Log(true,L"Error querying table for new message Service "); ...
    (microsoft.public.win32.programmer.messaging)
  • Re: Setting IMAP a/c as the default store
    ... Can you see it in OutlookSpy (click ... HRESULT hRes = S_OK; ... SRestriction sres; // Restriction structure. ...
    (microsoft.public.win32.programmer.messaging)