In this article I am trying to read the Outlook contact into a Combo Box and selecting a contact I am displaying his/ her details in below Label controls, so lets start building example.
Create a Windows Forms Application and Add Label and Combo Box and change the lable text to Select Contact.
To use the Outlook object in our project we need include a dll from the add references, now add a reference and select "Microsoft.Office.Interop.Outlook" dll from the list.
After adding the dll, now we will import the name space for that use following import
To access Outlook we need to create a object for Outlook via its interface and to get current session we need a NameSpace object to create these object use following code
Now in the Form Load we will initialise the objects and fill the combo box with contact names, for that in the Form_Load use following code
Once we get the list of contacts in the Combo box use will select a Contact on selecting a contact we will display his or her details in the labels we put on the form for that we need to add following coding in the ComboBox_SelectedIndexChanged event, basically we are searching through all contacts and get the selected contact and display his or her details
We need to clear the object memory we used in the project in Form_Disposed event
Now we are ready with our code just build, run and test
Tags: Reading Outlook Contacts using VB.NET
This is great, I wished if you left the code as text, but thanks after all .
ReplyDeleteThanks for sharing this...
ReplyDeleteI want to get Manager Name of a contact. Can you help me please? Thanks a lot in advance.