Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

ListItemCollection class

Represents a collection of ListItem objects.

Namespace:  Microsoft.SharePoint.Client
Assemblies:   Microsoft.SharePoint.Client.Silverlight (in Microsoft.SharePoint.Client.Silverlight.dll);  Microsoft.SharePoint.Client.Phone (in Microsoft.SharePoint.Client.Phone.dll)  Microsoft.SharePoint.Client (in Microsoft.SharePoint.Client.dll)
public class ListItemCollection : ClientObjectCollection<ListItem>

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.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.