Outlook Kontakte auslesen
-
Hallo,
ich möchte gerne meine E-Mail Kontakte aus Outlook auslesen.
public static void AccessContacts() { Microsoft.Office.Interop.Outlook.Application appl = new Microsoft.Office.Interop.Outlook.Application(); Microsoft.Office.Interop.Outlook.MAPIFolder folderContacts = appl.Session.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderContacts); int count = folderContacts.Items.Count; for (int i = 1; i <= count - 1; i++) { Microsoft.Office.Interop.Outlook.ContactItem c = (Microsoft.Office.Interop.Outlook.ContactItem)folderContacts.Items[i]; MessageBox.Show(c.LastName); } MessageBox.Show(count.ToString()); }
Es gibt zwar keine Fehlermeldung, dennoch werden auch keine Kontakte angezeigt bzw. der count bleibt bei 0.
Warum?