About the Object Environment
There are two ways to write code for Microsoft Outlook:
From outside the application, such as by using Microsoft Visual Basic or Microsoft Visual Basic for Applications in Microsoft Excel or another application.
From inside the application, such as by using Visual Basic for Applications or by using VBScript with an Outlook form.
Major components of the Outlook object model
The following table shows the major objects in the Outlook object model.
The top of the object hierarchy that represents the entire application. Enables you to reference other objects in the application and create items and objects. For example, this code creates an appointment in Outlook:
|
|
Represents the MAPI message store where all the Outlook items are stored. Provides methods for logging on and off Outlook and for referencing the default folders such as Mailbox, Inbox, Contacts, and others. For example, this code references the active user in Outlook:
|
|
Represents an account defined for the current profile. |
|
Represents a file on the local computer or a network drive that stores e-mail messages and other items for an account in the current profile. |
|
There are two folder objects, the Folders collection object that enables you to work with collections of folders and the Folder object that enables you to work with a single folder. For example, this code shows the collection of folders named Personal Folders in Outlook:
|
|
Represents a set of item data from a Folder or Search object, with items as rows of the table and properties as columns of the table. |
|
Represents an Outlook rule. |
|
Represents a customizable view used to sort, group, and view data. |
|
Represents the Outlook window. Enables you to show, return, and close the active window. For example, this code shows the active Outlook window in Outlook:
|
|
Represents the Navigation Pane displayed by the active Explorer object. |
|
Outlook items |
There are two item objects, the Items collection that enables you to work with items within a folder and the item objects that represents the standard item types in Outlook, such as MailItem that represents a mail message. In VBScript, the active item is assumed, so you do not need to enter the object model to reference it. For example, this code sets the Subject field of the active message in VBScript:
|
References forms. Use to show forms and pages. For example, this code shows the Options page of a form in Outlook:
|
|
Represents a form region in an Outlook form. |
|
Represents a document or link to a document contained in an Outlook item. |
|
Provides the ability to create, get, set, and delete properties on objects. |
|
Represents information about a given item property for an Outlook item object. |
|
Represents a custom property of an Outlook item. |
|
Each AddressEntry object in the AddressEntries collection holds information that represents a person or process to which the messaging system can deliver messages. |
|
The AddressList object is an address book that contains a set of AddressEntry objects. The entire hierarchy is available through the parent AddressLists collection. |
|
Provides detailed information about an AddressEntry that represents a Microsoft Exchange Server mailbox user. |
|
Provides detailed information about an AddressEntry that represents an Exchange distribution list. |
|
Represents a user or resource in Outlook, generally a mail message addressee. |
|
The Exception object holds information about one instance of an AppointmentItem object which is an exception to a recurring series. Unlike most of the other Outlook objects, the Exception object is a read-only object. |
|
Control |
There are the Microsoft Forms 2.0 controls that exist in the control toolbox by default, and the Outlook controls that are installed on your computer by default and that you will add to the control toolbox before using them for the first time in a form. |