SPListItem.Recycle Method

Deletes the item from the content database and returns a globally unique identifier (GUID) for the transaction.

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

Syntax

'Declaration
<ClientCallableMethodAttribute(RemoveThisObjectFromParentCollection := True)> _
<ClientCallableExceptionConstraintAttribute(FixedId := "4", Condition := "User does not have permissions to update this list item.",  _
    ErrorType := GetType(UnauthorizedAccessException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "1", ErrorCode := , Condition := "Expanded recurrence items cannot be updated.",  _
    ErrorType := GetType(SPException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "3", Condition := "Method 'Recycle' is not supported on Microsoft.SharePoint.SPListItem for external lists.",  _
    ErrorType := GetType(NotSupportedException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "2", ErrorCode := , Condition := "Item does not exist.The page you selected contains an item that does not exist.  It may have been deleted by another user.",  _
    ErrorType := GetType(SPException))> _
Public Function Recycle As Guid
'Usage
Dim instance As SPListItem
Dim returnValue As Guid

returnValue = instance.Recycle()
[ClientCallableMethodAttribute(RemoveThisObjectFromParentCollection = true)]
[ClientCallableExceptionConstraintAttribute(FixedId = "4", Condition = "User does not have permissions to update this list item.", 
    ErrorType = typeof(UnauthorizedAccessException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "1", ErrorCode = , Condition = "Expanded recurrence items cannot be updated.", 
    ErrorType = typeof(SPException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "3", Condition = "Method 'Recycle' is not supported on Microsoft.SharePoint.SPListItem for external lists.", 
    ErrorType = typeof(NotSupportedException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "2", ErrorCode = , Condition = "Item does not exist.The page you selected contains an item that does not exist.  It may have been deleted by another user.", 
    ErrorType = typeof(SPException))]
public Guid Recycle()

Return Value

Type: System.Guid
An identifier for the deletion transaction.

Exceptions

Exception Condition
NotSupportedException

The parent list has an external data source.

See Also

Reference

SPListItem Class

SPListItem Members

Microsoft.SharePoint Namespace