Pierre Savard

I need to track some email and send it trough a web service to a database.

I track all incoming email in thne NewMailEX function and store de EntryID in a collection.

A timer in another thread (to be shure that i do not miss NewMailEX event) take the entryID in the collection and send it to the web service.

If the web service stop responding, I whant to save the entryID in a outlook user property and send it later. The point is whats append if the user delete the email or move it in another folder. I think EntryID will be different if the email are moved.

Do you have a more optimum way to do this

Thanks a lot.

Re: Visual Studio Tools for Office What is the best way


Hello Pierre,

create a unige ID (GUID) and save that into a Field (Mileage) together with a Flag that tells you if you have processed the Item already

Looks like

Code Snippet
newMail.Mileage = "<processed>0</processed><id>c86ef22-857b-4edb-a5ce-744bb8982e42</id>";

So you can filter for the ID, wich you can save in your database to find the Item

and if you have already processed the Item.

Code Snippet
unprocessedItems = objFolder.items.Restrict("[Mileage] >= '<processed>0</processed>%'");
myMail = objFolder.items.Find("[Mileage] = '<processed>1</processed><id>c86ef22-857b-4edb-a5ce-744bb8982e42</id>'");

Also I would send the Parentfolder Path to your database.

But there are more Options.

Hope this helps,

greets Helmut