How can I tell whether a given MAPI message is incoming or outgoing?
In a COM-addin for Outlook (using Redemption) I need to be able to determine whether a given message that I'm looking at wa开发者_运维百科s 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?
An email itself has no concept of incoming or outgoing. We need to apply a frame of reference to it. Does incoming messages mean into your organization or into a mailbox? Most systems that calculate the "direction" of an email have 3 categories: inbound, outbound, and internal.
If you can't use the messages recipient's to determine the flow of the message, then you might need to better explain the situation because that would be the best method.
精彩评论