Security in Outlook Addins Created with VSTO

The security requirements of Outlook add-ins match those of document-level customizations for Word and Excel created with VSTO. By default VSTO solutions are very secure, using code access security (CAS). Additionally, in order for AddinLoader.dll to load a VSTO add-in, it must have the proper .NET Framework security policies applied. In Chapter 11 you will learn more about security requirements for Outlook add-ins created with VSTO.

Outlook 2003 improved its security model through the Outlook e-mail security update, which helps protect users from e-mail viruses. This security model (often referred to as the Outlook object model guard) prevents access to certain members of the Outlook object model. But it automatically trusts all installed COM add-ins, provided that you access any Outlook objects through the Outlook Application object that is referenced by ThisApplication. If you create a new instance of the Application object, then any calls into the restricted object model will cause a security warning to be displayed, as shown in Figure 10.20.

It is important to note that if a user clicks No on this dialog box, thereby denying access to a restricted property or method, it will cause an exception. You can avoid this type of error if you always access objects through the ThisApplication class rather than create a new instance of

Figure 10.20. Security warning (Outlook object model guard warning dialog box)

an Application object. Note, however, that when Outlook is used with Exchange server, administrators can specify that all VSTO add-ins be trusted, because they can specify that AddinLoader.dll be trusted. This means that if any AddinLoader.dll add-in attempts to access the restricted objects of Outlook's object model, the security warning shown in Figure 10.20 would not be displayed. Keep in mind that the security warning might still be displayed if Outlook has been configured to deny access to information within the object model.

If the end user has the Outlook macro security setting set to Very High or High, only add-ins that are signed with certificates are trusted and allowed to run. The AddinLoader.dll that shipped with VSTO was not signed, but if you install VSTO 2005 SE, a signed version of the DLL will replace the unsigned version.

0 0

Post a comment