Compartilhar via


SPListItemCollection.DeleteItemById Method

Deletes 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 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

The DeleteItemById method dirties the collection and thus should not be used in a foreach loop.

See Also

Reference

SPListItemCollection Class

SPListItemCollection Members

Microsoft.SharePoint Namespace