问题
I've been searching for a while, how to create a Contact Group in Outlook view of the Address book. In this case I don't mean a contact group to send an email to a lot of people (i.e. not a mailing list). It's only the view of the Address book within Outlook. A group can contain a number of Contact Folders.
Does anybody have an idea or some information to solve this problem via c#?
回答1:
You need to leverage the Contacts NavigationModule (ContactsModule) via Explorer.NavigationPane to control the Contact Groups.
Outlook.Folder contacts = Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts) as Outlook.Folder;
Outlook.ContactsModule module = Application.ActiveExplorer().NavigationPane.Modules.GetNavigationModule(Outlook.OlNavigationModuleType.olModuleContacts) as Outlook.ContactsModule;
Outlook.NavigationGroup group = module.NavigationGroups.Create("Custom Group"); // creates contact group
group.NavigationFolders.Add(contacts.Folders.Add("Business Contacts")); // adds folders to group
来源:https://stackoverflow.com/questions/10992768/how-to-create-a-group-of-contact-folders-in-outlook-via-c-sharp