views:

171

answers:

1

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?

A: 

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.

Joe Doyle
The main problem is that `PR_RECEIVED_BY_*` and `PR_RCVD_REPRESENTING_*` are not set for messages received via Public Folders. If they were, I would be 100% satisfied.
Oliver Giesen
Your best bet is still to look at the recipients table (recipients are sub-objects of the message, not properties) and see who got a copy of the message. If no one internal is there, it's an outbound message. Otherwise, I think you need to better explain how the email gets to the public folder. Is it being moved there or delivered there?
Joe Doyle
@Joe: messages are both moved and delivered there. the moving takes place both manually and automatically via an addin.
Oliver Giesen