Part 2: Automating Outlook using QTP | Overview of Outlook Object Model
In the previous article (Part 1: Automating Outlook using QTP | General Introduction), we read about the General Introduction about Automating Outlook using QTP. Before proceeding any further with automating different functionalities in MS Outlook, it would be a good idea to have basic understanding of some of the important objects in Outlook Object Model. This article provides a brief overview of some of these main objects.
The Application object is the topmost object in the Outlook Object Model and thus it represents the entire Outlook application. As this is the root object, you would need to create an instance of this object to access the Outlook Object Model. Some important purposes of Application object are –
- :: It allows access to other objects in the Outlook hierarchy.
- :: Its’ CreateItem method allows you to create new items such as email messages, tasks, appointments etc.
- :: It allows access to the active interface objects, Explorer & Inspector, using which you can access the windows that display the contents of a folder (emails, appointments etc) or the windows that display a single item (single email, appointment etc) respectively.
The Explorer object represents a window that displays the contents of a folder containing items such as email messages, tasks, appointments etc.
Contrary to Explorer object, the Inspector object represents a window that displays a single item such as an email message, an appointment or a task.
The MAPIFolder object represents a folder that contains email messages, tasks, contacts and various other items. MS Outlook provides a total of 16 default MAPIFolder objects. Example, olFolderInbox represents the Inbox folder. Similarly olFolderOutbox, olFolderSentMail, olFolderDeletedItems represent Outbox, Sent Mail & Deleted Items folders respectively.
As the name suggests, MailItem object represents an email message. MailItem objects are usually in folders, such as Inbox, Outbox, Sent Items etc. MailItem object provides various properties & methods that can be used to create and send emails.
The AppointmentItem object represents a meeting, a one-time appointment, a recurring appointment or meeting in the Calendar folder. The AppointmentItem object includes various properties & methods that specify meeting details such as the location and time & also perform actions such as responding to or forwarding meeting requests etc.
The ContactItem object represents a contact in the Contacts folder. ContactItem objects includes various properties that can contain person’s name, address, phone numbers and various other properties.