HI everyone,
I have made an Outlook 2013 add-in which listen old all incoming emails.
This is working fine for a couple of hours, but then it stoppes being notified about new emails, I have attached the code I use for subscribe to the event and the event it self.
private Outlook.MAPIFolder inbox = null;
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
//Loading the inbox
inbox = Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
inbox.Items.ItemAdd += new Outlook.ItemsEvents_ItemAddEventHandler(Items_ItemAdd);
}
void Items_ItemAdd(object Item)
{
if(settings.IsAddInEnabled)
{
ItemInspector(Item);
}
ribbon.lblCounter.Label = "Antal Mails siden start: " + ++counter;
}
private void ItemInspector(object Item)
{
if (Item is Outlook.MailItem)
{
var mail = Item as Outlook.MailItem;
if (mail.Attachments.Count > 0)
{
mail.UnRead = false;
}
}
}


