C# VSTO Outlook 2007: How to show contact by EntryID

Posted by DjCzermino on Stack Overflow See other posts from Stack Overflow or by DjCzermino
Published on 2011-01-04T23:49:25Z Indexed on 2011/01/04 23:54 UTC
Read the original article Hit count: 294

Filed under:
|
|
|
|

How to open Contact using C# VSTO Outlook 2007 addin by EntryID.

Now I am foreaching all contacts in Contact Folder:

string entryid = ...

Outlook.Application outlookApp = new Outlook.Application();
Outlook.MAPIFolder fldContacts = outlookApp.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts) as Outlook.MAPIFolder;
foreach (Outlook._ContactItem contact in fldContacts.Items)
{
    if (contact.EntryID==entryid) {
         contact.Display(false);
         break;
    }
}

but this is not effective code for many contacts in Contact Folder

© Stack Overflow or respective owner

Related posts about c#

Related posts about outlook