NavigationNodeCollection 類別
瀏覽節點的集合。
繼承階層架構
System.Object
Microsoft.SharePoint.Client.ClientObject
Microsoft.SharePoint.Client.ClientObjectCollection
Microsoft.SharePoint.Client.ClientObjectCollection<NavigationNode>
Microsoft.SharePoint.Client.NavigationNodeCollection
命名空間: Microsoft.SharePoint.Client
組件: Microsoft.SharePoint.Client.Silverlight (在 Microsoft.SharePoint.Client.Silverlight.dll 中); Microsoft.SharePoint.Client.Phone (在 Microsoft.SharePoint.Client.Phone.dll 中) Microsoft.SharePoint.Client (在 Microsoft.SharePoint.Client.dll 中)
語法
'宣告
Public NotInheritable Class NavigationNodeCollection _
Inherits ClientObjectCollection(Of NavigationNode)
'用途
Dim instance As NavigationNodeCollection
public sealed class NavigationNodeCollection : ClientObjectCollection<NavigationNode>
範例
此範例中的程式碼新增節點至指定網站的 [快速啟動] 區域,並顯示目前的快速啟動節點。
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);
}
}
}
執行緒安全
這類型的任何公用 static (共用 於 Visual Basic 中) 成員是安全執行緒。不保證任何執行個體成員都是安全執行緒。