Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Gets a collection of items from the list based on the specified query and view.
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
'Declaration
Public Function GetItems ( _
query As SPQuery, _
viewName As String _
) As SPListItemCollection
'Usage
Dim instance As SPList
Dim query As SPQuery
Dim viewName As String
Dim returnValue As SPListItemCollection
returnValue = instance.GetItems(query, _
viewName)
public SPListItemCollection GetItems(
SPQuery query,
string viewName
)
query
Type: Microsoft.SharePoint.SPQuery
A query that specifies which items to select.
viewName
Type: System.String
The GUID that specifies the view. This value must be enclosed in braces ({/}) and all uppercase. This value can be generated by using View.ID.ToString("B").ToUpper().
Type: Microsoft.SharePoint.SPListItemCollection
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, this method retrieves all of the items.
Please sign in to use this experience.
Sign in