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

SPList.GetItemById method

Gets the list item with the specified identifier (ID).

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
'Declaration
PublicFunctionGetItemById ( _
	idAsInteger _
) AsSPListItem
'Usage
DiminstanceAsSPListDimidAsIntegerDimreturnValueAsSPListItemreturnValue = instance.GetItemById(id)

Parameters

id
Type: System.Int32

The item ID. This value is not the index of the item within the collection of items for the list, but the value of the ID property of the list item.

Return value

Type: Microsoft.SharePoint.SPListItem
The list item with the specified ID.
ExceptionCondition
ArgumentException

The list item does not exist.

-or-

The list is not a user information list.

This method retrieves data for all fields of the specified item, which can have a significant impact on performance. To retrieve the data for only some fields, call the GetItemByIdSelectedFields(Int32, []) method with the desired fields.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.