SPList::GetItems method (String[])

Returns a collection of items from the list but includes only the specified field values.

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

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

Parameters

fields
Type: []

A variable number of field names for which to get values. If all fields should be retrieved, use the Items property instead.

Return value

Type: Microsoft.SharePoint.SPListItemCollection
A collection of list items.

ExceptionCondition
ArgumentNullException

fields is null .

This method creates a new SPQuery object from the specified fields and calls the GetItems(SPQuery) method with that new object to get the items.

This method is more efficient than accessing the Items property because it only fetches the values for the specified fields.

The following example is a console application that specifies field values to return in items retrieved from a list. After fetching the data, the application prints a simple report to the console.

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