How to: Add a Folder to the Favorite Folders Group
|Outlook Developer Reference|
You can add a folder to the Favorite Folders navigation group in Microsoft Office Outlook 2007 by using the Add method of the NavigationFolders collection for a NavigationGroup object. The Add method accepts a Folder object reference, to which the custom navigation folder is associated.
You can retrieve a NavigationGroup object reference to the default navigation group for a specified navigation group type by using the GetDefaultNavigationGroup method of the NavigationGroups object.
This sample creates a new mail folder for important items and adds a custom navigation folder for the new folder in the Favorite Folders navigation group of the Mail module.
The sample performs the following actions:
- The sample obtains a Folder object reference for the Inbox default folder for the current user, by using the GetDefaultFolder method of the NameSpace object.
- It then creates a new Folder object named "Important Items", representing the new mail folder, in the Folders collection of the Inbox default folder.
- The sample then obtains a reference to the NavigationPane object for the active explorer and uses the GetNavigationModule method of the NavigationModules collection to obtain a MailModule object reference.
- It then uses the GetDefaultNavigationGroup method of the NavigationGroups collection for the MailModule to obtains a NavigationGroup object reference to the Favorite Folders navigation group.
- Finally, the sample adds a new NavigationFolder object, based on the Folder object created earlier by the sample, to the navigation group by using the Add method of the NavigationGroups collection for that navigation group.