/*
   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