I'm currently writing an application where I'm trying to get all outlook contacts of the user that is running the program. I've got a code that works very fine for "normal" contacts, but I've got a problem when I'm running into contact groups.
Is there any way to get the contacts that are in the contact group (and only there and not as normal contacts) out of the contact group? (quite possible that I'm overlooking something there but when I debugged it and run into the contact group I did not find anything within item that gives me any list of content saved in the contact group (aka what contacts are within).
Microsoft.Office.Interop.Outlook.Items OutlookItems;
Microsoft.Office.Interop.Outlook.Application outlookHandler = new Microsoft.Office.Interop.Outlook.Application();
MAPIFolder Folder_Contacts = (MAPIFolder)outlookHandler.Session.GetDefaultFolder(OlDefaultFolders.olFolderContacts);
OutlookItems = Folder_Contacts.Items;
foreach (var item in OutlookItems)
{
ContactItem contact = item as ContactItem;
if (contact != null)
{
Console.WriteLine(contact.FirstName + " " + contact.LastName + ": " + contact.Email1Address);
}
}