Compartir a través de


List Class

Represents a list on a SharePoint Web site.

Inheritance Hierarchy

System.Object
  Microsoft.SharePoint.Client.ClientObject
    Microsoft.SharePoint.Client.SecurableObject
      Microsoft.SharePoint.Client.List

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.List", ServerTypeId := "{d89f0b18-614e-4b4a-bac0-fd6142b55448}")> _
Public Class List _
    Inherits SecurableObject
'Usage
Dim instance As List
[ScriptTypeAttribute("SP.List", ServerTypeId = "{d89f0b18-614e-4b4a-bac0-fd6142b55448}")]
public class List : SecurableObject

Remarks

The BrowserFileHandling, DataSource, EffectiveBasePermissions, HasUniqueRoleAssignments, IsAttachmentLibrary, OnQuickLaunch, SchemaXml, ValidationFormula and ValidationMessage properties are not included in the default scalar property set for this type.

Examples

This code example creates a new discussion board list on the current site.

using System;
using Microsoft.SharePoint.Client;

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

            ClientContext clientContext = new ClientContext(siteUrl);
            Web site = clientContext.Web;
            ListCreationInformation newListInfo = new ListCreationInformation();
            newListInfo.Title = "New Discussion Board";
            newListInfo.TemplateType = (int)ListTemplateType.DiscussionBoard;
            List newList = site.Lists.Add(newListInfo);

            clientContext.Load(newList);
            clientContext.ExecuteQuery();

            Console.WriteLine("Added Discussion Board: " + newList.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

List Members

Microsoft.SharePoint.Client Namespace