In a COM-addin for Outlook (using Redemption) I need to be able to determine whether a given message that I'm looking at was received or sent (I only want to act on the incoming ones). Simply looking at the parent folder or the recipients or senders will not work in my case as both incoming and outgoing messages might be thrown together inside the same (public) folder and there can be multiple valid senders. Furthermore there might also be internal messages sent from one valid sender to another.
Checking for PR_RECEIVED_BY_*
or PR_RCVD_REPRESENTING_*
to identify the incoming mails is also no complete solution for me because these properties are only set in mailbox stores and the messages I'm dealing with will most commonly be in the Public Folder Store (more precisely: in mail-enabled Public Folders, where messages sent on behalf of that folder are placed as well).
I already used OutlookSpy to compare MAPI properties of various sample messages and thought several times I had found something but so far nothing I found proved to be an ultimately stable solution (e.g. at first PR_MESSAGE_RECIP_ME
appeared to only ever be set on incoming messages and never on outgoing ones, but then I found incoming messages where that property was also missing).
Essentially, I'm looking for some property (or value thereof) that is always set on either incoming or outgoing messages only.
This needs to work at least with Exchange 2003 and 2007 and Outlook 2003 and 2007.
Any ideas?