I have a c# forms application witch i connect to outlook.
The program processes incoming mail, and should run stable during the day. The problem is that the program becomes unresponsive after a view hours, without a obvious reason.
I'm trying to log exceptions, but it just becomes unresponsive in the production environment. Any idea how to resolve this issue?
The program has some class variables:
Outlook.Application olApp;
Outlook.NameSpace olSession;
Outlook.MAPIFolder olInbox;
Outlook.Items olInboxItems
I connect outlook:
private void InitOutlook()
{
if (olApp == null)
olApp = new Outlook.Application();
olSession = olApp.GetNamespace("MAPI");
olInbox = olSession.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
olInboxItems = olPlanonIn.Items;
olInboxItems.ItemAdd += new Outlook.ItemsEvents_ItemAddEventHandler(InboxItemAdded);
}
Eventhandler for processing mails
private void InboxInItemAdded(object itm)
{
// process my mail
}