Search code examples
outlookvstooutlook-addinoffice-interopoffice-addins

VSTO Outlook: Execute default Outlook behavior for all folder events apart from the custom code


I have an Outlook Add-in in which I subscribe to ItemAdd event and some others for all the folders in the folder tree.

Within those events I place custom code but I am wondering if I am altering the current Outlook behavior for those folders events.

So is there any way for all the folders I subscribe to ItemAdd or some other events to tell Outlook to execute the default behavior (like when you call a base method) for those events apart from executing the custom code I have put inside those events?


Solution

  • The ItemAdd doesn't let you cancel the default action. The default behavior will be executed anyway.

    To prevent the default behavior the event handler should provide a special parameter for that. For example, the ItemSend event handler provides the cancel parameter which is false when the event occurs. If the event procedure sets this argument to true, the send action is not completed and the inspector is left open.