Condividi tramite


SPNavigationProvider Class

Provides a base class for Windows SharePoint Services site-map providers that is specialized for SharePoint site navigation.

Inheritance Hierarchy

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

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 Class SPNavigationProvider _
    Inherits SiteMapProvider

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

Remarks

Derives from the ASP.NET SiteMapProvider type.

Examples

The SPNavigationProvider class allows you to write custom controls to navigate a site. The following sample code accesses the root node for the Top Link Bar and Quick Launch. From that point, a user can navigate both node hierarchies.

<% @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 SPNavigationProvider properties
            <BR>
            <%

SPWeb web = SPControl.GetContextWeb(Context);

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

Response.Write ("<BR><DIV ID =\"quicklaunch\">" +
       prov.FindSiteMapNode(Context).Title + "</DIV>");
Response.Write("<BR><DIV ID=\"toplink\">" +
      prov.FindSiteMapNode("sid:1002") + "</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

SPNavigationProvider Members

Microsoft.SharePoint.Navigation Namespace

NavigationProvider

System.Configuration.Provider.ProviderBase

Other Resources

Implementing ASP.NET Site-Map Providers