To develop VSTO Add-ins for Microsoft Office Outlook, you can interact with the objects that are provided by the Outlook object model. The Outlook object model provides classes and interfaces that represent items in the user interface. For example, the Application object represents the entire application, the Folder object represents a folder that contains e-mail messages or other items, and the MailItem object represents an e-mail message.
This topic provides a brief overview of some of the main objects in the Outlook object model. For resources where you can learn more about the entire Outlook object model, see Use the Outlook object model documentation.
Outlook provides many objects with which you can interact. To use the object model effectively, you should be familiar with the following top-level objects:
The Application object represents the Outlook application, and it is the highest-level object in the Outlook object model. Some of the most important members of this object include:
The CreateItem method which you can use to create a new item such as an e-mail message, task, or appointment.
The Explorers property, which you can use to access the windows that display the contents of a folder in the Outlook user interface (UI).
The Inspectors property, which you can use to access the windows that display the contents of a single item, such as an e-mail message or meeting request.
To get an instance of the Application object, use the Application field of the ThisAddIn class in your project. For more information, see Program VSTO Add-ins.
Note
To help avoid security warnings when you use properties and methods that are blocked by the Outlook object model guard, get Outlook objects from the Application field of the ThisAddIn class. For more information, see Specific security considerations for Office solutions.
Explorer object
The Explorer object represents a window that displays the contents of a folder that contains items such as e-mail messages, tasks, or appointments. The Explorer object includes methods and properties that you can use to modify the window, and events that are raised when the window changes.
To get an Explorer object, do one of the following:
Use the GetExplorer method of the Folder object to get the Explorer for the current folder.
Inspector object
The Inspector object represents a window that displays a single item such as an e-mail message, task, or appointment. The Inspector object includes methods and properties that you can use to modify the window, and events that are raised when the window changes.
To get an Inspector object, do one of the following:
The MailItem object represents an e-mail message. MailItem objects are usually in folders, such as Inbox, Sent Items, and Outbox. MailItem exposes properties and methods that can be used to create and send e-mail messages.
The AppointmentItem object represents a meeting, a one-time appointment, or a recurring appointment or meeting in the Calendar folder. The AppointmentItem object includes methods that perform actions such as responding to or forwarding meeting requests, and properties that specify meeting details such as the location and time.
The ContactItemobject represents a contact in the Contacts folder. ContactItem objects contain a variety of contact information for the people they represent, such as street addresses, e-mail addresses, and phone numbers.
For complete information about the Outlook object model, you can refer to the Outlook primary interop assembly (PIA) reference and the VBA object model reference.
In addition to providing information for all of the types in the PIAs, this documentation also provides additional information about the structure of the PIAs and code examples for common Outlook automation tasks.
VBA object model reference
The VBA object model reference documents the Outlook object model as it is exposed to Visual Basic for Applications (VBA) code. For more information, see Outlook 2010 object model reference.
All of the objects and members in the VBA object model reference correspond to types and members in the Outlook PIA. For example, the Inspector object in the VBA object model reference corresponds to the Inspector object in the Outlook PIA. Although the VBA object model reference provides code examples for most properties, methods, and events, you must translate the VBA code in this reference to Visual Basic or Visual C# if you want to use them in an Outlook VSTO Add-In project that you create by using Visual Studio.