Question

I can listen on default folder like this:

_outlookNameSpace = this.Application.GetNamespace("MAPI");
_inbox = _outlookNameSpace.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox);
_items = _inbox.Items;
_items.ItemAdd += new Outlook.ItemsEvents_ItemAddEventHandler(items_ItemAdd);

How can I add a listener on all folders and sub folders ?

Or listen for all incoming mail before it is placed in a folder or subfolder ?

Was it helpful?

Solution

You need to store Items objects in a list (not just the _items variable) and set up the ItemAdd event handler on all folders that you are interested in.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top