GetItems(Microsoft.SharePoint.SPQuery, String) Method

The GetItems method of the SPList class returns a collection of list items from the list based on the specified query and view.

Parameters

query   A Microsoft.SharePoint.SPQuery object that specifies the query.

viewName   A string that contains the GUID specifying the view enclosed within braces ({}) and all upper-case. This value can be generated using View.ID.ToString("B").ToUpper().

Return Value

A Microsoft.SharePoint.SPListItemCollection object that represents the list items.

Remarks

The properties of the view that is specified by the viewName parameter override the properties specified in the query object passed through the query parameter. For example, if the query object includes a <Where> tag that specifies only items containing a particular column value, while the view specifies to return all items, all items will be returned

Requirements

Platforms: Microsoft Windows Server 2003

Security: Code Access Security