SPListItemCollection.DeleteItemById method

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

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

Syntax

'Declaration
Public Sub DeleteItemById ( _
    id As Integer _
)
'Usage
Dim instance As SPListItemCollection
Dim id As Integer

instance.DeleteItemById(id)
public void DeleteItemById(
    int id
)

Parameters

  • id
    Type: System.Int32

    A 32-bit integer that identifies the item to delete.

Exceptions

Exception Condition
ArgumentException

An item with the specified ID could not be found.

Remarks

This DeleteItemById method modifies the collection and thus should not be used in a foreach loop.

See also

Reference

SPListItemCollection class

SPListItemCollection members

Microsoft.SharePoint namespace