ListItemCollection class

Represents a collection of ListItem objects.

Inheritance hierarchy

System.Object
  Microsoft.SharePoint.Client.ClientObject
    Microsoft.SharePoint.Client.ClientObjectCollection
      Microsoft.SharePoint.Client.ClientObjectCollection<ListItem>
        Microsoft.SharePoint.Client.ListItemCollection

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

Syntax

'Declaration
Public Class ListItemCollection _
    Inherits ClientObjectCollection(Of ListItem)
'Usage
Dim instance As ListItemCollection
public class ListItemCollection : ClientObjectCollection<ListItem>

Remarks

To return a collection of items from a list, it is a best practice to use one of the GetItems* methods of the List class.

Once you return a list item collection and assign it to an ListItemCollection object, you can use an indexer to return a single item from the collection. For example, assuming the collection is assigned to a variable named collListItems, use collListItems[index] in C#, or collListItems(index) in Visual Basic, where index is either the index number of the item in the collection or the display name of a list field. Alternatively, to return a single item from the item collection in a list, use one of the Get* methods of List or another SharePoint Server object whenever possible to return specific items or files. If you use one of these methods, you do not enumerate all the items in the list or library to return the item. For example, use the [Overload:Microsoft.SharePoint.Client.Web.GetFileByRelativeUrl(System.String)] method of the Web class to return a specific file from a library in a website by its relative URL, or use the GetItemById(Int32) method of the List class to retrieve a specific item when you know its GUID.

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

ListItemCollection members

Microsoft.SharePoint.Client namespace