Creating contacts

ContactItem  objContact = objOutlook.CreateItem(olContactItem);

objContact.FullName = "Abhijit";

objContact.Email1Address = "abhijit@contoso.com";

objContact.CompanyName = "Contoso";

objContact.JobTitle = "Consultant";

objContact.HomeTelephoneNumber = "533-522-1111";

objContact.HomeAddress = "India" ;

objContact.Birthday = "9/15/1966";

objContact.Save();

 

 

Methods for looking up contacts

This can be done using several methods. I will point you to this nice post on Wes’ blog rather than re-writing the same code. However, shoot me a mail if you bump into a blocker.

http://weblogs.asp.net/whaggard/archive/2007/01/30/how-do-i-access-my-outlook-contacts-from-my-web-application.aspx

 

Filtering contacts

NameSpace oNS= oApp.GetNamespace("mapi");

oNS.Logon(<profile>,<Password>,false,false) ;

MAPIFolder cContacts = oNS.GetDefaultFolder(OlDefaultFolders.olFolderContacts);

Items oItems = cContacts.Items;

ContactItem  oCt;

oCt = oItems.Find("Filter string") ;

That's it, just use a filter string corresponding to your application requirements.