FieldCollection class

Represents a collection of Field objects.

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

No code example is currently available or this language may not be supported.

The Document library templates sample app for SharePoint includes an example of how to use this object.

This code example displays the available fields in the Announcements list.

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


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show: