A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

How to access message recipients (MAPI)



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old June 26th 07, 06:15 AM posted to microsoft.public.outlook.program_addins
Ivan
external usenet poster
 
Posts: 39
Default 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?
  #2  
Old June 27th 07, 12:18 AM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default How to access message recipients (MAPI)

No, I am afraid not. You can create a restriction on the on the recipients
though.
Do you really need to process all recipients in all messages in a given
folder?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Ivan" wrote in message
...
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?



  #3  
Old June 27th 07, 04:52 AM posted to microsoft.public.outlook.program_addins
Ivan
external usenet poster
 
Posts: 39
Default How to access message recipients (MAPI)

I need to get all recipients (their names and emails) of every message.
Message properties PR_DISPLAY_TO and PR_DISPLAY_CC are not exactly what I
need.
  #4  
Old June 27th 07, 07:54 AM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default How to access message recipients (MAPI)

Then opening each and every message is your only option...

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Ivan" wrote in message
...
I need to get all recipients (their names and emails) of every message.
Message properties PR_DISPLAY_TO and PR_DISPLAY_CC are not exactly what I
need.



  #5  
Old June 27th 07, 09:46 AM posted to microsoft.public.outlook.program_addins
Ivan
external usenet poster
 
Posts: 39
Default How to access message recipients (MAPI)

Ok. Thanks.
  #6  
Old July 10th 07, 01:26 PM posted to microsoft.public.outlook.program_addins
Ivan
external usenet poster
 
Posts: 39
Default How to access message recipients (MAPI)

Dmitry, is it possible to open each message avoiding of calling
OpenEntry(msgEntryID)? It takes high time.

Now I open mapi folder using spIMsgStore-OpenEntry(), then open mapi table
- spIFolder-GetContentsTable(), query all rows from the table (also using
SetColumns() to access only one property - PR_ENTRYID), and after that I
should open each message using spFolder-OpenEntry() to have an ability to
call GetRecipientTable() method.

What if I need to read only all recipients for each message without reading
other message properties?

In MSDN I found that contents of PR_MESSAGE_RECIPIENTS should be accessed by
the IMAPIProp::OpenProperty method, requesting the IID_IMAPITable interface
identifier. But I have no idea how to realize it.

The fact is that Reunion's Outlook Addin (www.reunion.com) read all
recipients from all messages extremely fast (only first launch is meaningful
cause it cashes results in its own db).
 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
URGENT!!! - MAPI Issues with vesion changes of Outlook and Access The Facilitator Outlook and VBA 16 April 16th 07 02:15 PM
Using Item.Send to e-mail from Access through Outlook 2003 with multiple recipients Tuck 'n Roll Outlook and VBA 1 December 1st 06 09:02 PM
prevent e-mail message recipients automatically forward a message IH Outlook - Using Forms 3 November 1st 06 09:00 PM
Experts Challenge: MAPI is unable to access Public Folder store items [email protected] Outlook - General Queries 9 October 27th 06 12:54 PM
I don't want the recipients to reply my message Chi Outlook - General Queries 1 March 29th 06 04:40 PM


All times are GMT +1. The time now is 05:59 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.