Get receiver address from mail item in older Outlook versions (<= 2010)

Add-in Express™ Support Service
That's what is more important than anything else

Get receiver address from mail item in older Outlook versions (<= 2010)
 
Jeroen Diederix


Guest


Hi,

I am trying to get the receiving address of an incoming mail item. In Outlook with versions after 2010 the SendUsingAccount field of the incoming mail item is filled with the email address of the receiving account. However, for older versions (I want to be compatible from 2007 onward) this field is empty.

Is there another way to get the receiving email address?

I have tried so far:
- MAPI field: PR_RECEIVED_BY_EMAIL_ADDRESS(_A) -> not filled in
- Current session active account -> not working with multiple accounts, get sometimes the wrong account
- Header fields -> I try to find the receiving email address somewhere in the mail headers, but I did not find one that always works. The 'TO' header for instance can contain more than one recipient.

I hope someone knows a more robust solution that always works.

Thanks!
Jeroen.
Posted 24 May, 2016 06:30:55 Top
Andrei Smolin


Add-in Express team


Posts: 18819
Joined: 2006-05-11
Hello Jeroen,

I suggest that you ask this question on the Outlook for Developers forum at https://social.msdn.microsoft.com/Forums/en-US/home?forum=outlookdev.


Andrei Smolin
Add-in Express Team Leader
Posted 25 May, 2016 07:11:56 Top
Andrei Smolin


Add-in Express team


Posts: 18819
Joined: 2006-05-11
Jeroen,

I've found out that SendUsingAccount is set to the account under which the MailItem is to be sent, not received! See https://msdn.microsoft.com/en-us/library/office/ff869311.aspx. On the other hand I suppose you can use MailItem.ReceivedByEntryID or MailItem.ReceivedByName properties, see https://msdn.microsoft.com/en-us/library/office/ff869438.aspx and https://msdn.microsoft.com/en-us/library/office/ff866935.aspx.


Andrei Smolin
Add-in Express Team Leader
Posted 25 May, 2016 08:51:31 Top