PortalSiteMapProvider Properties: IncludePages, DynamicChildLimit

October 22, 2007

The PortalSiteMapProvider class is the base provider used by the four default “CMS” SiteMapProviders:

  • GlobalNavSiteMapProvider
  • CombinedNavSiteMapProvider
  • CurrentNavSiteMapProvider
  • CurrentNavSiteMapProviderNoEncode

That is, all of these SiteMapProviders use the same base code to generate a data source, but their “output” differs slightly due to the different attributes that are applied.

Recently, we wanted to filter out the pages from showing up in our left-navigation. You can do this at the rendering stage, but since the PortalSiteMapProvder gives us an IncludePages property, we can simply create a new entry in web.config for our “custom” provider, like this:

<add name="CurrentNavNoPagesSiteMapProvider" description="CMS provider for Current navigation" type="Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider, Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" NavigationType="Current" EncodeOutput="true" IncludePages="Never" />

By default, there is also a 50 returned-items limit; we can set the DynamicChildLimit to “0″ to override this.

<add name="CurrentNavNoLimitSiteMapProvider" description="CMS provider for Current navigation" type="Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider, Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" NavigationType="Current" EncodeOutput="true" DynamicChildLimit="0" />

Of course, you can combine the different properties to come up with a combination you need. The next thing we would need to do is reference these new providers, and voila!

And if you haven’t read Chris Richard’s series of articles about MOSS Navigation and how to get better performance using the PortalSiteMapProvider, you really should…

tags: , , ,
posted in Programming, Reference, SharePoint, SP2007 by Sherman

Follow comments via the RSS Feed | Leave a comment | Trackback URL

Leave Your Comment

Get Adobe Flash playerPlugin by wpburn.com wordpress themes
 
Powered by Wordpress and MySQL. Theme by Shlomi Noach, openark.org