This documentation is archived and is not being maintained.

SPList.GetItems Method (SPQuery, String)

Windows SharePoint Services 3

Returns a collection of list items from the list based on the specified query and view.

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

Public Function GetItems ( _
	query As SPQuery, _
	viewName As String _
) As SPListItemCollection
Dim instance As SPList
Dim query As SPQuery
Dim viewName As String
Dim returnValue As SPListItemCollection

returnValue = instance.GetItems(query, _


Type: Microsoft.SharePoint.SPQuery
An SPQuery object that specifies the query.
Type: System.String
A string that contains the GUID that specifies the view that is enclosed in braces ({}) and that is all uppercase. This value can be generated using View.ID.ToString("B").ToUpper().

Return Value

Type: Microsoft.SharePoint.SPListItemCollection
An SPListItemCollection object that represents the list items.

The properties of the view that is specified by the viewName parameter override the properties that are specified in the query object that is 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.