共用方式為


FieldCollection 類別

代表Field物件的集合。

繼承階層架構

System.Object
  Microsoft.SharePoint.Client.ClientObject
    Microsoft.SharePoint.Client.ClientObjectCollection
      Microsoft.SharePoint.Client.ClientObjectCollection<Field>
        Microsoft.SharePoint.Client.FieldCollection

命名空間:  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 Class FieldCollection _
    Inherits ClientObjectCollection(Of Field)
'用途
Dim instance As FieldCollection
public class FieldCollection : ClientObjectCollection<Field>

備註

Document library templates sample app for SharePoint包括如何使用此物件的範例。

範例

此範例中的程式碼會宣告] 清單中顯示可用的欄位。

using System;
using Microsoft.SharePoint.Client;

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

            ClientContext clientContext = new ClientContext(siteUrl);
            Web site = clientContext.Web;
            List targetList = site.Lists.GetByTitle("Announcements");
            FieldCollection collField = targetList.Fields;
            clientContext.Load(
               collField, 
               fields => fields
                  .Include(field => field.Title)
               );
            clientContext.ExecuteQuery();

            Console.WriteLine("The following fields are available in the Announcements list:\n\n");
            foreach (Field myField in collField)
               Console.WriteLine(myField.Title);
        }
    }
}

執行緒安全

這類型的任何公用 static (共用 於 Visual Basic 中) 成員是安全執行緒。不保證任何執行個體成員都是安全執行緒。

請參閱

參照

FieldCollection 成員

Microsoft.SharePoint.Client 命名空間