다음을 통해 공유


SPListItemCollection.GetItemById Method

Returns the item with the specified integer ID from the collection.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
Public Function GetItemById ( _
    id As Integer _
) As SPListItem
'Usage
Dim instance As SPListItemCollection
Dim id As Integer
Dim returnValue As SPListItem

returnValue = instance.GetItemById(id)
public SPListItem GetItemById(
    int id
)

Parameters

  • id
    Type: System.Int32

    A 32-bit integer that identifies the item. The value of this parameter does not correspond to the index of the item within the collection of items for the list, but to the value of the ID property of theSPListItem class.

Return Value

Type: Microsoft.SharePoint.SPListItem
An SPListItem object that represents the list item.

Remarks

The GetItemById method returns an ArgumentException exception if the item is not found.

See Also

Reference

SPListItemCollection Class

SPListItemCollection Members

Microsoft.SharePoint Namespace