Export (0) Print
Expand All

SPSiteMapProvider class

Provides the SiteMapNode objects that constitute the global content portion of the breadcrumb, which represents objects in the site hierarchy.


Namespace:  Microsoft.SharePoint.Navigation
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public sealed class SPSiteMapProvider : SiteMapProvider

Derives from the ASP.NET SiteMapProvider type.

The SPSiteMapProvider class allows you to write custom controls to navigate a site. The following sample code displays the names of the nodes that you retrieve by using various methods of the provider.

<% @Page language="C#" Debug=true%>
<%@ Register Tagprefix="SharePoint" 
      Assembly="Microsoft.Sharepoint" %>
<%@ Register Tagprefix="SharePointNavigation"
      Assembly="Microsoft.Sharepoint" %>
<%@ Register Tagprefix="SharePointWebControls"
       Assembly="Microsoft.Sharepoint" %>
            Verify the SPSiteMapProvider Properties
SPWeb web = SPControl.GetContextWeb(Context);

SPSiteMapProvider prov = (SPSiteMapProvider)

Response.Write ("<BR><DIV ID =\"context\">" +
      prov.FindSiteMapNode(Context).Title + "</DIV>");
Response.Write("<BR><DIV ID=\"url\">" +
      prov.FindSiteMapNode(web.Url) + "</DIV>");
Response.Write ("<BR><DIV ID = \"key\">" +
      prov.FindSiteMapNodeFromKey(web.ID.ToString()) + "</DIV>");


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Community Additions

© 2014 Microsoft