简体   繁体   中英

How to create a group of contact folders in outlook via c#

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 ( ie 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#?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM