Search code examples
c#outlookvstoexchange-serveroutlook-web-addins

Outlook Add-in to always run


I am trying to create an add-in which runs all the time even when outlook is closed or the user is using OWA and needs to be able to act off the data in the headers of incoming emails. I have already created the VSTO (in c#) for this. However, obviously this stops when outlook is closed. Is it possible to use the code for an add-in that runs continuously? And is the best Add-in for this the outlook web add-in?


Solution

  • By it definition, and addin is only running when its host app is running. That aplies to both COM and web addins. If you need something running continously, you need to create a standalone app. It can either use the Outlook Object Model (make sure the profile it uses is online rather than cached) or EWS.

    Is your problem that NewMailEx event does not fire on messages received while your VSTO addin was not active? In that case you can check on startup for the unread messages in the Inbox folder (MAPIFolder.Items.Restrict)) and process Items.ItemAdd event (it will fire when the cached profile synchronizes server emails to the cached Inbox folder).