Search code examples
outlookvstooutlook-addinoffice-interopoffice-addins

VSTO Outlook Attach to an event on folder creation


Every time a folder is manually created by the user I need to subscribe to some folder events such as ItemAdd.So how can I handle when a new folder is created and then subscribe to its events?


Solution

  • Use the Folders.FolderAdd event which is available in the Outlook object model and which is fired when a folder is added to the specified Folders collection. The Folder that is added is passed as a parameter, so you can subscribe to the ItemAdd event instantly.

    See FoldersEvents_Event.FolderAdd Event for more information.