I use the Exchange Web Services managed API 2.2 to monitor user inboxes and must determine if the email is a new item, a reply, or a forwarded message.
I saw various articles about SO, such as how to notice that mail is redirected mail? and is there a way to determine if an email is a reply / reply using ews c #? which help in specific cases, but I still cannot figure out how to distinguish the response from the redirected element.
The first article adds an extra 5 bytes each time (forward or in response), so I don't know what was the last.
The second article suggests using it InReplyTo, however, when I examine the property for forwarded email messages, it contains the sender's email address (but not null).
I have seen other articles, such as this or this , that suggest using advanced properties to check values in PR_ICON_INDEX, PR_LAST_VERB_EXECUTED and PR_LAST_VERB_EXECUTION_TIME.
My code is as follows, but never returns a value for lastVerbExecuted
var lastVerbExecutedProperty = new ExtendedPropertyDefinition(4225, MapiPropertyType.Integer);
var response = service.BindToItems(newMails, new PropertySet(BasePropertySet.IdOnly, lastVerbExecutedProperty));
var items = response.Select(itemResponse => itemResponse.Item);
foreach (var item in items)
{
object lastVerb;
if (item.TryGetProperty(lastVerbExecutedProperty, out lastVerb))
{
}
}
source
share