Compartir a través de


NavigationNodeCollection Class

A collection of navigation nodes.

Inheritance Hierarchy

System.Object
  Microsoft.SharePoint.Client.ClientObject
    Microsoft.SharePoint.Client.ClientObjectCollection
      Microsoft.SharePoint.Client.ClientObjectCollection<NavigationNode>
        Microsoft.SharePoint.Client.NavigationNodeCollection

Namespace:  Microsoft.SharePoint.Client
Assemblies:   Microsoft.SharePoint.Client.Silverlight (in Microsoft.SharePoint.Client.Silverlight.dll);  Microsoft.SharePoint.Client (in Microsoft.SharePoint.Client.dll)

Syntax

'Declaration
<ScriptTypeAttribute("SP.NavigationNodeCollection", ServerTypeId := "{2d818ed7-8fef-4a1c-bceb-a9404dfa482f}")> _
Public Class NavigationNodeCollection _
    Inherits ClientObjectCollection(Of NavigationNode)
'Usage
Dim instance As NavigationNodeCollection
[ScriptTypeAttribute("SP.NavigationNodeCollection", ServerTypeId = "{2d818ed7-8fef-4a1c-bceb-a9404dfa482f}")]
public class NavigationNodeCollection : ClientObjectCollection<NavigationNode>

Examples

This code example adds a node to the Quick Launch area of the specified site and displays the current Quick Launch nodes.

using System;
using Microsoft.SharePoint.Client;

namespace Microsoft.SDK.SharePointFoundation.Samples
{
    class NavigationNodeCollectionExample
    {
        static void Main()
        {
            string siteUrl = "http://MyServer/sites/MySiteCollection";

            ClientContext clientContext = new ClientContext(siteUrl);
            Web site = clientContext.Web;

            // Get the Quick Launch navigation node collection.
            NavigationNodeCollection collQuickLaunchNode = site.Navigation.QuickLaunch;

            // Set properties for a new navigation node.
            NavigationNodeCreationInformation ciNavicationNode = new NavigationNodeCreationInformation();
            ciNavicationNode.Title = "New Node";
            ciNavicationNode.Url = "https://localhost";
            // Create node as the last node in the collection.
            ciNavicationNode.AsLastNode = true;
            collQuickLaunchNode.Add(ciNavicationNode);

            clientContext.Load(collQuickLaunchNode);
            clientContext.ExecuteQuery();

            Console.WriteLine("Current nodes:\n");
            foreach (NavigationNode navNode in collQuickLaunchNode)
               Console.WriteLine(navNode.Title);
        }
    }
}

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

NavigationNodeCollection Members

Microsoft.SharePoint.Client Namespace