How to access message recipients (MAPI)
I use next code (was simplified here) for accessing message recipients, but
it works too slowly:
SizedSPropTagArray( 3, cols ) = { 3, { PR_ENTRYID, PR_SUBJECT,
PR_SENDER_NAME } };
MAPIUtils::QueryAllRows( spTable, (SPropTagArray*)&cols, 0, 0, 0, &pRowSet );
for( UINT i = 0; i pRowSet-cRows; i++ )
{
// processing recipients
spFolder-OpenEntry( row-lpProps[0].Value.bin.cb,
(LPENTRYID)row-lpProps[0].Value.bin.lpb, NULL, 0, &messagetype,
(IUnknown**)&spMessage );
CComPtrIMAPITable spRecipientTable;
spMessage-GetRecipientTable( MAPI_UNICODE, &spRecipientTable );
SizedSPropTagArray( 3, rcptcols ) = { 3, { PR_EMAIL_ADDRESS,
PR_RECIPIENT_TYPE, PR_DISPLAY_NAME } };
MAPIUtils::QueryAllRows( spRecipientTable, (SPropTagArray*)&rcptcols, 0,
0, 0, &pRows );
for( UINT r = 0; r pRows-cRows; r++ )
{
// loop through all the recipient' properties
for ( int ii = 0; ii pRows-aRow[r].cValues; ii++ )
{
ULONG ulPT = pRows-aRow[r].lpProps[ii].ulPropTag;
switch ( ulPT )
{
case PR_EMAIL_ADDRESS:
// ...
}
}
}
//processing PR_SUBJECT and PR_SENDER_NAME properties here...
}
Are there another ways to read message recipients without opening entry and
retrieving recipients table?
|