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

纵然是瞬间 提交于 2019-12-10 18:39:07

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!