Compartilhar via


PortalNavigation classe

Representa a navegação para páginas do portal e outros objetos de navegação do portal.

Inheritance hierarchy

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

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

Sintaxe

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

Comentários

O exemplo de código a seguir configura o portal navegação de um site especificado.

Exemplos

/ 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();
                }
            }
        }
    }
}

Segurança de thread

Os membros públicos estática (Shared no Visual Basic) desse tipo são seguros para thread. Nenhum membro de instância pode ser garantido como seguro para thread.

Ver também

Referência

PortalNavigation membros

Microsoft.SharePoint.Publishing.Navigation namespace