.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Sandeep Singh

Home >> Articles >> .Net Framework >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Vb.Net and outlook object model

Posted By:Hirendra Sisodiya       Posted Date: November 19, 2009    Points: 25    Category: .Net Framework    URL: http://www.dotnetspark.com  

This article shows what the outlook object model is and how to use with vb.net; article describes some approaches of outlook object modal.

Microsoft Office provides a powerful component model to automate from another program or application. We can read, delete and manage Mail Items, Calendar Items, Journal Entries, and any other item that Outlook normally exposes such as Contacts, Notes, Tasks using outlook Object modal. We   can automate Outlook from a .NET application with the help of COM Interop. First we will discuss about Outlook Object model .

The Outlook object model provides various objects such as Application ,Explorer,Inspector,MAPIFolder, MailItem,AppointmentItem ,TaskItem,ContactItem  etc

 Application Object (this is the main or root object):

Using the Application Object

When you use Automation to control Microsoft Outlook from another application, you use the CreateObject method to create an Outlook Application object.

The following Visual Basic for Application example starts Microsoft Outlook (if it's not already running) and opens the default Inbox folder.

Set myOlApp = CreateObject("Outlook.Application")

Set myNameSpace = myOlApp.GetNameSpace("MAPI")

Set myFolder= myNameSpace.GetDefaultFolder(olFolderInbox)



Namespace object (responsible for controlling sessions, folders operation, items etc)

 Represents an abstract root object for any data source. The object itself 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.

Using the NameSpace Object

Use GetNameSpace ("MAPI") to return the Outlook NameSpace object from the Application object.

The only data source supported is MAPI, which allows access to all Outlook data stored in the user's mail stores.

 Explorer Object (responsible for showing all outlook folders)

Inspector Class (it is responsible for showing the item)

Use the Inspectors property to return the Inspectors object from the Application object. The following example shows how to retrieve the Inspectors object in Microsoft Visual Basic or Microsoft Visual Basic for Applications (VBA).

Dim myOlApp as New Outlook.Application

Set myInspectors = myOLApp.Inspectors


The following example shows how to retrieve the Inspectors object in Microsoft Visual Basic Scripting Edition (VBScript).

Set myInspectors= Application.Inspectors

 Subscribe to Articles


Further Readings:

Author: Rahul         Company URL: http://www.dotnetspark.com
Posted Date: November 20, 2009

Hi Hirendra Sisodiya,

Nice article..I guess you are using outlook API is it correct? or some 3rd party software.

Also Hirendra is there any way i can get the address book details from outlook?

Thanks & Regards

Post Comment

You must Sign In To post reply

    Read also another Resources from the same Author

Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend