Share via


SPContentMapProvider Class

Provides methods and properties for implementing a site map provider for contents of a Windows SharePoint Services site. This class provides the System.Web.SiteMapNode objects that constitute the content breadcrumb, where "content" referes to the lists, folders, items, and list forms composing the breadcrumb.

Inheritance Hierarchy

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

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

Syntax

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

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

Examples

The SPContentMapProvider class allows you to write custom controls to navigate a site. The following sample code displays the name 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>
            Tests the SPContentMapProvider properties
            <BR>
            <%

SPWeb web = SPControl.GetContextWeb(Context);

SPContentMapProvider prov =
     (SPContentMapProvider)SiteMap.Providers["SPContentMapProvider"];

Response.Write ("<BR><DIV ID =\"context\">" +
      prov.FindSiteMapNode(Context) + "</DIV>");
Response.Write("<BR><DIV ID=\"url\">" + 
      prov.FindSiteMapNode(web.Url) + "</DIV>");
Response.Write("<BR><DIV ID=\"key\">" +
      prov.FindSiteMapNodeFromKey(web.ID.ToString()) + "</DIV>");
Response.Write("<BR><DIV ID=\"children\">" +
      prov.GetChildNodes(prov.CurrentNode).Count + "</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

SPContentMapProvider Members

Microsoft.SharePoint.Navigation Namespace

System.Web.SiteMapProvider

Other Resources

How To: Add Simple Site Navigation