Freigeben über


SPNavigationNode-Klasse

Stellt einen Knoten in einer hierarchischen Navigationsstruktur für eine Microsoft SharePoint Foundation -Website.

Vererbungshierarchie

System.Object
  Microsoft.SharePoint.Navigation.SPNavigationNode

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

Syntax

'Declaration
Public NotInheritable Class SPNavigationNode
'Usage
Dim instance As SPNavigationNode
public sealed class SPNavigationNode

Hinweise

Im Gegensatz zu der SPNavigationNodeCollection -Klasse muss die SPNavigationNode -Klasse Aufrufen der Update -Methode zum Auslösen des Eigenschaftsänderungen, die vorhandenen Knoten in der Datenbank gespeichert werden soll. Verschiebungen tritt jedoch sofort ein.

Beispiele

Die folgende Konsolenanwendung druckt eine einfache Zuordnung der Navigationsstruktur für eine Website.

using System;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Navigation;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            using (SPSite site = new SPSite("https://localhost"))
            {
                using (SPWeb web = site.OpenWeb())
                {
                    string format = "|-{0} (Id = {1})";

                    foreach (SPNavigationNode globalNode in web.Navigation.GlobalNodes)
                    {
                        Console.WriteLine(format, globalNode.Title, globalNode.Id);

                        foreach (SPNavigationNode childNode in globalNode.Children)
                        {
                            Console.WriteLine("  " + format, childNode.Title, childNode.Id);
                        }
                        Console.WriteLine("|");
                    }
                }
            }
            Console.Write("\nPress ENTER to continue....");
            Console.ReadLine();
        }
    }
}
Imports System
Imports Microsoft.SharePoint
Imports Microsoft.SharePoint.Navigation

Module ConsoleApp

    Sub Main()

        Using site As New SPSite("https://localhost")

            Using web As SPWeb = site.OpenWeb()

                Dim format As String = "|-{0} (Id = {1})"

                For Each globalNode As SPNavigationNode In web.Navigation.GlobalNodes
                    Console.WriteLine(format, globalNode.Title, globalNode.Id)

                    For Each childNode As SPNavigationNode In globalNode.Children
                        Console.WriteLine("  " + format, childNode.Title, childNode.Id)
                    Next
                    Console.WriteLine("|")
                Next

            End Using

        End Using

        Console.Write(vbCrLf & "Press ENTER to continue....")
        Console.Read()
    End Sub

End Module

Threadsicherheit

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

Siehe auch

Referenz

SPNavigationNode-Member

Microsoft.SharePoint.Navigation-Namespace

Microsoft.SharePoint.Navigation.SPNavigation

Microsoft.SharePoint.Navigation.SPNavigationNodeCollection