/*
   list all contacts with Outlook 
taken from Example05.cs */
private void Example05Main() { // start outlook Outlook.Application outlookApplication = new Outlook.Application(); // enum contacts Outlook.MAPIFolder contactFolder =
outlookApplication.Session.GetDefaultFolder(OlDefaultFolders.olFolderContacts);
for (int i = 1; i <= contactFolder.Items.Count; i++) { Outlook.ContactItem contact = contactFolder.Items[i] as Outlook.ContactItem; if (null != contact) { ListViewItem listItem = listView1.Items.Add(i.ToString()); listItem.SubItems.Add(contact.CompanyAndFullName); } } // close outlook and dispose outlookApplication.Quit(); outlookApplication.Dispose(); }

Last edited Jun 13, 2012 at 9:41 AM by SebastianDotNet, version 6

Comments

Kulu May 31, 2016 at 9:27 AM 
Hello, is this still working?

When trying to access my Outlook i get a "co e server exec failure". Im using the newest Outlook and am trying to list my contacts in a List<>.

vidya1 Nov 21, 2013 at 6:38 AM 
Hi,

I have a sub folder in contacts folder in outlook.
How can i get sub folder contacts from c#.

Thanks,
Vidya