PortalSiteMapProvider Saturday, Aug 16 2008 

The PortalSiteMapProvider object is the true source of hierarchical navigation data and it provides the data to the PortalSiteMapDataSource object. The PortalSiteMapProvider retrieves nodes from the Windows SharePoint Services 3.0 SPNavigation store. You use the SPNavigation object to create static links and groupings. After you provide static links and groupings, the application merges in dynamic items that represent Web sites and pages with the static links and groupings. Office SharePoint Server 2007 also applies security trimming so that users see only the navigation items to which they have permission to navigate.
Declare named providers in the application’s web.config file to make them widely accessible. Declarations of the two most important PortalSiteMapProvider objects—
CombinedNavSiteMapProvider and CurrentSiteNavSiteMapProvider—are shown in the following code.

<add name=”CombinedNavSiteMapProvider” description=

“MOSS 2007 provider for Combined navigation” Type=”Microsoft.SharePoint.Publishing.
Navigation.PortalSiteMapProvider”
NavigationType=”Combined” EncodeOutput=”true”>
<add name=”CurrentNavSiteMapProvider” description=
“MOSS 2007 provider for Current navigation” Type=
“Microsoft.SharePoint.Publishing.
Navigation.PortalSiteMapProvider”
NavigationType=”Current” EncodeOutput=”true”/>
Note : The name of the first provider, CombinedNavSiteMapProvider, matches the value specified for the SiteMapProvider property. This indicates that a Horizontal menu will be created.
The following are the properties,
  1. NavigationType – Gets or sets the type of navigation for this navigation provider. Available options include “Combined”, “Current”, and “Global” and behave as specified by the next three properties: CombinedNavSiteMapProvider, CurrentSiteMapProvider, and CurrentSiteNavSiteMapProviderNoEncode.
  2. CombinedNavSiteMapProvider – Gets the PortalSiteMapProvider object that is attached by default to the global navigation menu.
  3. CurrentSiteNavSiteMapProvider – Gets the PortalSiteMapProvider object that is attached by default to the current navigation menu or the QuickLaunch toolbar.
  4. CurrentSiteNavSiteMapProviderNoEncode – Gets the PortalSiteMapProvider object that is attached by default to the breadcrumb navigation.
    Declare this property almost identically to CurrentSiteNavSiteMapProvider, but exclude the EncodeOutput=”true” attribute.
  5. GlobalNavSiteMapProvider – Gets a PortalSiteMapProvider object with the NavigationType property set to Global.
  6. EncodeOutput – Gets or sets whether to HTML-encode the Title property of any PortalSiteMapNode object returned by the provider.The ASP.NET 2.0 menu control does not automatically HTML-encode the Title property when rendering. However, the ASP.NET 2.0 SiteMapPath control does HTML-encode the Title property.
  7. DynamicChildLimit – Gets or sets the number of dynamic child items to show at each level. Dynamic child items can be subsites (any SPWeb objects) and pages.
  8. RequireUniqueKeysForNodes – Gets or sets whether nodes returned from the provider should each have unique values for their Key properties.
    To enable menu highlighting to work correctly on authored links and headings, set RequireUniqueKeysForNodes=”false”. This does not cause problems when attaching to an ASP.NET 2.0 menu control through a data source, but for most other display controls, declare RequireUniqueKeysForNodes=”true”.
  9. IncludeSubSites – Gets or sets whether this provider returns subsites.

Cheers…

PortalSiteMapDataSource Saturday, Aug 16 2008 

The PortalSiteMapDataSource is a data source specific to Office SharePoint Server 2007 that retrieves data from the PortalSiteMapProvider object and exposes data according to the ASP.NET 2.0 hierarchical data source interface. The PortalSiteMapDataSource object specifies the name of the PortalSiteMapProvider object it uses to retrieve data through the ASP.NET 2.0 SiteMapProvider property.
When the master page markup includes the DataSourceID=”GlobalNavDataSource” attribute, the application returns a PortalSiteMapDataSource object.

<PublishingNavigation:PortalSiteMapDataSource ID=”GlobalNavDataSource” Runat=”server” SiteMapProvider=”CombinedNavSiteMapProvider” ShowStartingNode=”false” StartFromCurrentNode=”true” StartingNodeOffset=”0″ TrimNonCurrentTypes=”Heading” TreatStartingNodeAsCurrent=”true”/>

The properties are,

  1. ShowStartingNode – Affects whether the starting node is returned by the data source.When this property is set to true, the data source returns the starting node. The menu receives the starting node, which can be the root node, and items below the starting node.When this property is set to false, the data source does not return the starting node. The menu receives only the items below the starting node.
  2. StartFromCurrentNode – Affects where the data source starts. That is, this property sets which section of the overall site hierarchy the data source control returns to the menu.When this property is set to true, Office SharePoint Server 2007 instructs the PortalSiteMapDataSource object to apply its rules for determining where it should be starting.
  3. StartingNodeOffset – Gets or sets a positive or negative integer offset from the starting node that determines the top-level site hierarchy that is exposed by the DataSourceControl object.The default is 0, which indicates that the top-level site hierarchy exposed by the SiteMapDataSource object is the same as the starting node.The effect of this property is variable, undefined, and depends on site hierarchy details that are out of scope for this topic.
  4. TrimNonCurrentTypes – Allows context-based and type-based node trimming.
    In this example, TrimNonCurrentTypes=”Heading”, which instructs the data source to remove any nodes of type Heading that are not directly below the current node.
    You can specify multiple values for this property in a comma-delimited list. Available values are defined in the
    NodeTypes enumeration.
  5. TrimNonAncestorTypes – Trims any specified types that are not directly below the current site or one of its ancestors.
  6. TrimNonAncestorDescendantTypes – Trims any nodes of specified types that are not below the current site or one of its ancestor or descendant sites.
  7. TreatStartingNodeAsCurrent – Affects which node is treated as the current node for trimming purposes. By default, current node refers to the node representing the item that is currently being visited.When TreatStartingNodeAsCurrent is set to true, the starting node of the data source is treated as the context or trimming node.

Cheers…