Search code examples
c#asp.netexchangewebservices

EWS Figure out the identical email sent to multiple recipients


Imagine a company email setup:

incomming@company
Emails in: 1-Help Me, 2-Hello

person1@company
Emails in:1-Hi Person1, 2-Help Me, 3-Invoice, 4-Hello

person2@company
Emails in:1-Help Me, 2-Hello, 3-Fix Bug

All the emails in incoming are stored in incoming but also get received by person1 and person2.

is there some identifier that can help me figure out that "Help me" and "Hello" exist three times in all the emails, so when reading all the emails for all the people, I don't read those two emails three times each ?

FindItemsResults<Item> findResults = service.FindItems(folder.Id, filter, new ItemView(100000));
foreach (Item item in findResults.Items)
{
    item.ConversationId
    item.Id
    //seam to be unique for all different users
}

Another example is person1 writes an email to person2. When looping trough both people's folders, the same email comes out twice. Once in person1's sent items and once is person2's Inbox.


Solution

  • The InternetMessageId which is assigned by the sending MTA https://msdn.microsoft.com/en-us/library/office/aa564528(v=exchg.150).aspx will be the same on each of the received messages in this case. (this will also correlate to what you see in the Message Tracking Logs).