共用方式為


SPListItemCollection.DeleteItemById method

從集合中刪除具有指定的整數 ID 的項目。

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

Syntax

'宣告
Public Sub DeleteItemById ( _
    id As Integer _
)
'用途
Dim instance As SPListItemCollection
Dim id As Integer

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

參數

  • id
    Type: System.Int32

    識別要刪除的項目為 32 位元整數。

Exceptions

Exception Condition
ArgumentException

找不到具有指定之 ID 的項目。

備註

這個DeleteItemById方法修改集合,並因此應該不會用於迴圈中, foreach 。

請參閱

參照

SPListItemCollection class

SPListItemCollection members

Microsoft.SharePoint namespace