Compartir a través de


SPSiteMapProvider Class

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

Inheritance Hierarchy

System.Object
  System.Configuration.Provider.ProviderBase
    System.Web.SiteMapProvider
      Microsoft.SharePoint.Navigation.SPSiteMapProvider

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

Syntax

<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
<AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
<AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
Public NotInheritable Class SPSiteMapProvider _
    Inherits SiteMapProvider

Dim instance As SPSiteMapProvider
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public sealed class SPSiteMapProvider : SiteMapProvider

Remarks

Derives from the ASP.NET SiteMapProvider type.

Examples

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" 
      Namespace="Microsoft.SharePoint" 
      Assembly="Microsoft.Sharepoint" %>
<%@ Register Tagprefix="SharePointNavigation"
      Namespace="Microsoft.SharePoint.Navigation"
      Assembly="Microsoft.Sharepoint" %>
<%@ Register Tagprefix="SharePointWebControls"
      Namespace="Microsoft.SharePoint.WebControls"
       Assembly="Microsoft.Sharepoint" %>
<HTML>
      <BODY>
            Verify the SPSiteMapProvider Properties
            <BR>
            <%
SPWeb web = SPControl.GetContextWeb(Context);

SPSiteMapProvider prov = (SPSiteMapProvider)
      SiteMap.Providers["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>");

%>
     </BODY>
</HTML>

Thread Safety

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

See Also

Reference

SPSiteMapProvider Members

Microsoft.SharePoint.Navigation Namespace

System.Web.SiteMapProvider

Other Resources

Implementing ASP.NET Site-Map Providers