Using a Trusted Application Object Provided by Office Developer Tools for Visual Studio

Office 2013 and later

If you are developing a managed add-in by using Office Developer Tools for Visual Studio, always use the Application object that is provided by Visual Studio. Unless you intend to automate a new instance of Outlook, do not use the New or new keyword to create a new instance of Outlook, as this instance of the Application object is not trusted from the perspective of the Outlook Object Model Guard. If your add-in uses an untrusted instance of the Application object, depending on the version of Outlook that the client is running, the add-in by default will invoke Outlook's Object Model Guard on a number of members of the object model. For more information about the behavior of the Object Model Guard, see Code Security Changes in Outlook 2007. Note that even though the "Code Security Changes in Outlook 2007" article refers to COM add-ins that are trusted by default, this design applies to versions of Outlook since Outlook 2007, and the trust applies to managed add-ins the same way. Regardless of whether the add-in is managed or not, the trust is based on the assumption that the add-in uses a trusted Application object.