Outlook add-in: Incoming email notification

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to receive new email notificaitons from outlook add-in written
using C# and VSTO for 2005 ? Outlook add-in code needs to be notified when an
email arrives in the inbox, so that the add-in can spawn a web service for
the sender and update a target CRM system.

Thanks,
Venkat
 
Sure. Use the Items.Add event on the Inbox folder's Items collection or the
NewMailEx event at the Application level.
 
Hello

I got a question for you.

My requirement is almost same as Andy requested, however, the request here
is to export entire email into the database.

Now, whenever the mail receive, I need to make call to the webservice that
has all data to export into database in XML format. Everything has done,
except that I am unable to know what all new email has been added.

Options that I tried:

NewMail event - it trigger only once even if I receive more than one email.
And since it does not have any parameter to know which item has added, it is
hard to get things done.

NewMailEX (...) where EntityId is a parameter to know Item that has added.
And as per the Microsoft Office website, EntityID parameter contain value
separate with , (comma) if we added more than 1 item. But I could not find
that I am receiving value in with , (comma) separated. I checked in forum
where it saying that it bahave like that when we have Exchange server :( so
this door closed as well!!

ItemAdd(...) The one known issue is that ItemAdd won't fire if more than 16
items are added to the folder at one time.

Any suggestion?

Cheers,
Amit
 
I get comma separated values from NewMailEX and I use it with my Exchange
mailbox.

However, all the events you can receive for incoming mails (as well as other
events such as ItemChange and ItemRemove) won't fire if more than 16 items
are affected at once. That's a limitation of the underlying MAPI provider.
It only provides a notification that the table has changed under those
circumstances, not what items have arrived or been changed.

You can run a procedure called from a timer to check a folder to see if
anything's there (or not there) that wasn't already processed by your code.
That's the usual workaround.
 
Back
Top