SharePoint 2010 PortalNavigation Class represents navigation for portal pages and other portal navigation objects. The PortalNavigation type exposes the following members and all of them are Public properties.
- AutomaticSortingMethod: Controls the property to use when automatically sorting navigation items owned by this site.
- CurrentDynamicChildLimit: Controls the maximum number of "dynamic" child items to show beneath this site in current (left) navigation.
- CurrentIncludePages: Controls whether publishing pages in this site will be automatically included in current navigation.
- CurrentIncludeSubSites: Controls whether sub-sites of this site will be automatically included in its current navigation.
- CurrentNavigationNodes: A collection of SPNavigationNode objects that get included in the current navigation of the associated site.
- GlobalDynamicChildLimit: Controls the maximum number of "dynamic" child items to show beneath this site in global navigation.Dynamic children are sub-sites (represented by SPWeb objects) and publishing pages. The default value is 20. Setting the value to 0 removes the limit.
- GlobalIncludePages: Controls whether publishing pages in this site will be automatically included in global navigation.
- GlobalIncludeSubSites: Controls whether sub-sites of this site will be automatically included in its global navigation.
- GlobalNavigationNodes: A collection of SPNavigationNode objects that get included in the global navigation of the associated site.
- InheritCurrent: Controls whether the associated site should display its own current navigation or should use the current navigation of its parent.
- InheritGlobal: Controls whether the associated site should display its own global navigation or whether it should use the global navigation of its parent.
- OrderingMethod: Controls the ordering of navigation items owned by this site.
- ShowSiblings: Controls whether this site should display its sibling items in the current navigation.
- SortAscending: Sorts items in a portal navigation in ascending alphanumeric order.
This is how we use these properties in Site definitions. To control the navigation settings of the site you need to activate the ‘NavigationProperties’ feature and specify the properties that you want to apply to the site.
<WebFeatures>
...
...
<!–- Navigation properties for global and current navigation -–>
<Feature ID="541F5F57-C847-4e16-B59A-B31E90E6F9EA">
<Properties xmlns="http://schemas.microsoft.com/sharepoint/">
<Property Key="InheritGlobalNavigation" value="false" />
<Property Key="InheritCurrentNavigation" value="false" />
<Property Key="GlobalIncludeSubSites" value="true" />
<Property Key="GlobalIncludePages" value="true" />
<Property Key="CurrentIncludeSubSites" value="false" />
<Property Key="CurrentIncludePages" value="false" />
<Property Key="IncludeInGlobalNavigation" value="true" />
<Property Key="IncludeInCurrentNavigation" value="true" />
</Properties>
</Feature>
</WebFeatures>
PortalNavigation Class description and a code example to configures portal navigation for a specified site is available on MSDN here.