You may experience compilation errors and run-time errors when you try to set the Visual Studio 2005 Tools for the Office System "Application" object to an "Outlook.Application" object (908431)



The information in this article applies to:

  • Microsoft Visual Studio Tools for the Microsoft Office System version 2003
  • Microsoft Office Outlook 2003

SYMPTOMS

You may experience the following errors when you try to set the Microsoft Visual Studio 2005 Tools for the Microsoft Office System Application object to an Outlook.Application object:
  • Compilation errors
  • Run-time errors

CAUSE

The Microsoft Visual Studio Tools for the Microsoft Office System version 2003 Application object is derived from the Microsoft.Office.Interop.Outlook.Application interface. Therefore, a reference to the Visual Studio Tools for the Office System version 2003 Application object is functionally identical to a reference to the Outlook.Application object.

However, a reference to the Visual Studio 2005 Tools for the Office System Application object is not type identical to a reference to the Outlook.Application object. Instead, the Visual Studio 2005 Tools for the Office System Application object is a wrapper around the Outlook.Application object. Therefore, a reference to the Visual Studio 2005 Tools for the Office System Application object is not functionally identical to a reference to the Outlook.Application object.

WORKAROUND

To work around this issue, change all code references of the Microsoft.Office.Interop.Outlook.Application interface to one of the following references:
  • The Microsoft.Office.Tools.Outlook.Application interface
  • The yournamespace.Application interface

MORE INFORMATION

If you have to integrate legacy code, third-party libraries, or code that requires a reference to the Microsoft.Office.Interop.Outlook.Application interface, you can obtain a reference to the native Microsoft.Office.Interop.Outlook.Application interface type in Microsoft Visual Studio 2005. To do this, follow these steps:
  1. Obtain a reference to the Visual Studio 2005 Tools for the Office System Application object.
  2. Obtain a reference to one of the child collections of the Visual Studio 2005 Tools for the Office System Application object. For example, obtain a reference to the Inspectors collection.
  3. Take a reference to the child collection's Application object. For example, take a reference to the Inspectors.Application object.
In Visual Studio 2005, only the native Outlook.Application object is trusted by the Microsoft Outlook object model guard. If you use the Outlook.Application object, you may experience security issues.

REFERENCES

For more information about Outlook objects, visit the following Microsoft Developer Network (MSDN) Web sites:

Modification Type:MinorLast Reviewed:2/3/2006
Keywords:kbtshoot kbprb KB908431 kbAudDeveloper