There are two ways to write code for Outlook:
Learn more about the differences between using Visual Basic for Applications and VBScript
View the Outlook object hierarchy
Learn about recent changes to the Outlook object library
Application | 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 Visual Basic for Applications or VBScript:
|
NameSpace | 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 Visual Basic for Applications or VBScript:
|
Explorer | 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 Visual Basic for Applications or VBScript:
|
Folders | There are two folder objects, the Folders collection object that enables you to work with collections of folders and the MAPIFolder object that enables you to work with a single folder. For example, this code shows the collection of folders named Personal Folders in Outlook Visual Basic for Applications or VBScript:
|
Outlook items | There are two item objects, the Items collection object 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:
|
Inspector | References forms. Use to show forms and pages. For example, this code shows the Options page of a form in Outlook Visual Basic for Applications or VBScript:
|
AddressEntry | Each AddressEntry object in the AddressEntries collection holds information that represents a person or process to which the messaging system can deliver messages. |
AddressList | The AddressList object is an address book that contains a set of AddressEntry objects. The entire hierarchy is available through the parent AddressLists collection. |
Exception | 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 two control objects, the Controls collection object that enables you to work with all the controls on a page and the specific control object that enables you to work with a control. For example, this code sets the Caption of a CommandButton control named "CommandButton1" on a page named "Test" in VBScript:
|