|Outlook object model|
The above mind map structure represents the flow of objects that we have used to work with outlook API model.
It is the parent object which represents the entire Microsoft Outlook application.
When we use Automation to control Microsoft Outlook from another application (UFT in our case), we use the CreateObject method to create an Outlook Application object.
You can read the complete outlook object model, to learn more.
Set objOutlook= CreateObject(“Outlook.Application”)
This object provides methods for logging in and out, accessing storage objects directly by ID, accessing certain special default folders directly, and accessing data sources owned by other users in outlook Application.
We have used GetNamespace (“MAPI”) method, to return the Outlook Namespace object from the Application object (objOutlook in our case).
Syntax:-Set OutlookSetNameSpace = objOutlook.GetNamespace(Cstr(UCase(sNameSpace)))Note: – The only supported name space type is “MAPI” in Outlook
MAPI: – The Messaging Application Programming Interface (MAPI) is a proprietary email protocol of Microsoft, that is used by Outlook (Microsoft’s email client software) to communicate with Microsoft Exchange (its email server software). Thus MAPI provides the messaging architecture for Microsoft Outlook, it provides a set of interfaces, functions, and other data types to facilitate working with outlook.
Folder object: –
We have used GetDefaultFolder(FolderType) method which Returns a Folder object that represents the default folder of the requested type.In our case FolderType = 6 , which refers the inbox folder.
Set OutlookSetFolder = objNamespace.GetDefaultFolder(sFolder)
Properties of Email: – Further we have accessed the Subject,To,CC,Body,… properties to fetch the required values.
Function for Outlook,
1.Creating and Destroying Outlook object
|Creating/Destroying Outlook Object|
2.Referring the Outlook Namespace
5.Setting the Read/Unread Filter
|Set filter on Outlook Emails|
More Practical Scenarios