Good Day
I am trying to export contacts to Excel using Outlook 2010 and VS 2010. However all code examples are related to VS2008 and Outlook 2007. I am new to the .NET environment and would like to know if someone could point me in the right direction. I have created a function AccessContacts that i just want to step through the contact list and filter out Category = Business Contacts and then i will have to export it to excel CSV...... I have attached my function which does work in Outlook 2007 for some reason:( Hope someone can help......
private void AccessContacts(string findCatName) { Outlook.MAPIFolder folderContacts = this.Application.ActiveExplorer().Session. GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts); Outlook.Items searchFolder = folderContacts.Items; int counter = 0; foreach (Outlook.ContactItem foundContact in searchFolder) { if (foundContact.FirstName.Contains(findCatName)) { foundContact.Display(false); counter = counter + 1; } } MessageBox.Show("You have " + counter + " contacts with last names that contain " + findCatName + "."); }