Outlook Object Model Overview
To develop 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 MAPIFolder 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 Using the Outlook Object Model Documentation.
Applies to: The information in this topic applies to application-level projects for Outlook 2007 and Outlook 2010. For more information, see Features Available by Office Application and Project Type.
For a related video demonstration, see How Do I: Use Outlook to Create a Custom Task Report?.
Accessing Objects in an Outlook Project
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 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.
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:
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:
Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox corresponds to the Inbox folder in Outlook.
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.
For an example that shows how to create an e-mail message, see How to: Create an E-Mail Item.
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.
For an example that shows how to create an appointment, see How to: Create a Meeting Request.
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 an example that shows how to create a new contact, see How to: Add an Entry to Outlook Contacts. For an example that shows how to search for an existing contact, see How to: Search for a Specific Contact.
Using the Outlook Object Model Documentation
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.
Primary Interop Assembly Reference
The Outlook PIA reference documents the types in the primary interop assemblies for Outlook 2010 and Outlook 2007. This documentation is available from the following locations:
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. The VBA object model reference for Outlook is available from the following locations:
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 Microsoft.Office.Interop.Outlook.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 add-in project that you create by using Visual Studio.
Provides topics that show how to perform tasks with contacts.
Provides topics that show how to perform tasks with mail items.
Provides topics that show how to perform tasks with folders.
Provides topics that show how to perform tasks with calendar items.
Shows how to add a Windows Form to a Microsoft Office Outlook project and display the form to the user.
Shows how to read data from a custom field of a contact item.
Shows how to determine the parent MAPIFolder of an unsaved contact item.
Shows how to display the name of the current folder and some information about the selected item.