سؤال

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 ?

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top