OwaisM

Hi,

i am getting E_INVALIDARG at line 17. Is there any thing going wrong when
i run this code it shows "bin.cb" equals to a big number and "bin.lpb" is a
a pointer to zero. (using MAPI & WM 5.0)

please help me in this regard... thanks.

------------------------------------------------------------------------------------------------------------------

IMAPITable* pTable1;
enum {ePR_SUBJECT, ePR_ENTRYID, NUM_COLS};

LPSRowSet psrs1 = NULL;
ULONG ulObjType;
LPSRowSet pRows = NULL;

HRESULT hr = pfldrInbox->GetContentsTable(MAPI_DEFERRED_ERRORS, &pTable1);

while (SUCCEEDED(pTable1->QueryRows( 1, 0, &pRows)) && pRows->cRows > 0)
{

// Get the first item in the Inbox and get its entry ID.
// IMessage* lpMessage;
LPMESSAGE lpMessage;

HRESULT hRes = pStore->OpenEntry(pRows->aRow[0].lpProps[ePR_ENTRYID].Value.bin.cb,
(LPENTRYID)pRows->aRow[0].lpProps[ePR_ENTRYID].Value.bin.lpb,
NULL,
MAPI_BEST_ACCESS,
&ulObjType,
(LPUNKNOWN *)&lpMessage); // -----> Error LINE No 17

if (hRes != S_OK) break; << getting hRes == E_INVALIDARG

char* to = NULL, *cc = NULL, *bcc = NULL;
hr = GetRecipients(lpMessage, &to, &cc, &bcc);

}



Re: Smart Devices Native C++ Development Unable to retrive IMessage from Contents-Table of Inbox

Sean Y Xia

Hi,

After you gett content table, you shoule set the columns

enum
{
ePR_ENTRYID,
NUM_COLS
};

SizedSPropTagArray(NUM_COLS, Columns) =
{
NUM_COLS,
PR_ENTRYID
};

HRESULT hr = pfldrInbox->GetContentsTable(MAPI_DEFERRED_ERRORS, &pTable1);

hr = pTable1->SetColumns((LPSPropTagArray)&Columns, 0);

while (SUCCEEDED(pTable1->QueryRows( 1, 0, &pRows)) && pRows->cRows > 0)
{

...

}

B.R.

Sean





Re: Smart Devices Native C++ Development Unable to retrive IMessage from Contents-Table of Inbox

OwaisM


Thanks a lot, the problem is resolved.

but I got new problem. actualy I want to get the TO, CC, BCC from email message.

I got an error at GetRecipientTable() i.e. MAPI_E_NO_RECIPIENTS "error no:-2147219961"

Please help me
Thanks

-----------------------------------------------------------------------------------------------

HRESULT hr = pMessage->GetRecipientTable(MAPI_UNICODE, &pRecipientTable); << getting error "MAPI_E_NO_RECIPIENTS"


if (hr != S_OK)
{
STLOG_LASTERROR;
return 0;
}

const int nProperties=RECIPIENT_COLS;
SizedSPropTagArray(nProperties,Columns)={nProperties,{PR_RECIPIENT_TYPE, PR_DISPLAY_NAME, PR_EMAIL_ADDRESS, PR_ADDRTYPE, PR_ENTRYID }};


hr = pRecipientTable->SetColumns((LPSPropTagArray)&Columns,0);