How to: Enumerate Active Folders in the Calendar View
Outlook Developer Reference |
In Microsoft Office Outlook 2007, you can traverse the group and folder hierarchy of a module in the Navigation Pane by using the NavigationGroups and NavigationFolders collections. The NavigationGroups collection of the NavigationModule object contains each navigation group displayed in a navigation module, while the NavigationFolders collection of the NavigationGroup object contains each navigation folder displayed in a navigation group.
By using these collections in combination, you can enumerate each navigation folder for a navigation module displayed in the Navigation Pane.
The following sample counts the number of navigation folders selected for display in the Calendar navigation module of the Navigation Pane. The sample performs the following actions:
- The sample first obtains a reference to the NavigationPane object for the active explorer.
- It then uses the GetNavigationModule method of the NavigationModules collection to obtain a reference to the CalendarModule object from the NavigationPane object.
- The sample then enumerates through the NavigationGroups collection of the CalendarModule object. For each NavigationGroup in the collection, the sample then enumerates the NavigationFolders collection.
- If the IsSelected property of a NavigationFolder object contained in the NavigationFolders collection is set to True, the variable
intCounter
is incremented. - Finally, the sample displays a dialog box containing the value of
intCounter
.
|