PortalNavigation-Klasse

Stellt die Navigation für Portalseiten und andere Portalnavigationsobjekte dar.

Vererbungshierarchie

System.Object
  Microsoft.SharePoint.Publishing.Navigation.PortalNavigation

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

Syntax

'Declaration
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
Public NotInheritable Class PortalNavigation
'Usage
Dim instance As PortalNavigation
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
public sealed class PortalNavigation

Hinweise

Im folgenden Codebeispiel wird die Portalnavigation für einen angegebenen Standort konfiguriert.

Beispiele

/ Assemblies that need to be referenced in this sample:
//     Microsoft.SharePoint.dll
//     Microsoft.SharePoint.Publishing.dll

using System;

using Microsoft.SharePoint;
using Microsoft.SharePoint.Publishing;
using Microsoft.SharePoint.Publishing.Navigation;

namespace Microsoft.SDK.SharePointServer.Samples
{
    public class Program
    {
        public static void Main(string[] args)
        {
            // Configure the portal navigation settings for a particular site.
            using (SPSite siteCollection = new SPSite("http://yourServer"))
            {
                using (SPWeb site = siteCollection.OpenWeb("/site1"))
                {
                    PublishingWeb pubSite = PublishingWeb.GetPublishingWeb(site);
                    PortalNavigation portalNav = pubSite.Navigation;

                    // Show pages in the current navigation (on the left for LTR languages using SharePoint's
                    // default Master Pages).
                    portalNav.CurrentIncludePages = true;

                    // Increase the number of dynamic children in the current navigation to 50.
                    portalNav.CurrentDynamicChildLimit = 50;

                    // Disable global navigation inheritance, establishing the site as the new global navigation root
                    // for any sites below it; also disable the sibling display behavior for the current navigation.
                    portalNav.InheritGlobal = false;
                    portalNav.ShowSiblings = false;

                    // Enable automatic sorting for all of the site's navigation items.
                    portalNav.OrderingMethod = OrderingMethod.Automatic;

                    using (SPWeb siteToHide = siteCollection.OpenWeb("/site1/site2"))
                    {
                        // Hide a specific sub-site from display in global navigation.
                        portalNav.ExcludeFromNavigation(true, siteToHide.ID);

                        // Hide a specific sub-site from display in current navigation.
                        portalNav.ExcludeFromNavigation(false, siteToHide.ID);
                    }

                    // Save the changes to the store.
                    pubSite.Update();
                }
            }
        }
    }
}

Threadsicherheit

Alle öffentlichen static (Shared in Visual Basic) Member dieses Typs sind threadsicher. Die Threadsicherheit von Instanzmembern ist nicht gewährleistet.

Siehe auch

Referenz

PortalNavigation-Member

Microsoft.SharePoint.Publishing.Navigation-Namespace