Partilhar via


SPList.Recycle Method

Recycles the list and returns the list's globally unique identifier (GUID).

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

Syntax

'Declaration
<ClientCallableExceptionConstraintAttribute(FixedId := "listnotfound", ErrorCode := , Condition := "The list is not found.",  _
    ErrorType := GetType(SPException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "accessdenied", Condition := "User does not have permissions to update this list.",  _
    ErrorType := GetType(UnauthorizedAccessException))> _
<ClientCallableMethodAttribute(RemoveThisObjectFromParentCollection := True)> _
<ClientCallableExceptionConstraintAttribute(FixedId := "notsupported", ErrorCode := , Condition := "Recycle bin is disabled.",  _
    ErrorType := GetType(SPException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "listuniquenotdeletable", ErrorCode := ,  _
    Condition := "The list can not be deleted.", ErrorType := GetType(SPException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "a", ErrorCode := , Condition := "This list cannot be deleted because it has related lists with relationship behavior constraints.",  _
    ErrorType := GetType(SPException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "listnotdeletable", ErrorCode := , Condition := "The list can not be deleted.",  _
    ErrorType := GetType(SPException))> _
Public Function Recycle As Guid
'Usage
Dim instance As SPList
Dim returnValue As Guid

returnValue = instance.Recycle()
[ClientCallableExceptionConstraintAttribute(FixedId = "listnotfound", ErrorCode = , Condition = "The list is not found.", 
    ErrorType = typeof(SPException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "accessdenied", Condition = "User does not have permissions to update this list.", 
    ErrorType = typeof(UnauthorizedAccessException))]
[ClientCallableMethodAttribute(RemoveThisObjectFromParentCollection = true)]
[ClientCallableExceptionConstraintAttribute(FixedId = "notsupported", ErrorCode = , Condition = "Recycle bin is disabled.", 
    ErrorType = typeof(SPException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "listuniquenotdeletable", ErrorCode = , 
    Condition = "The list can not be deleted.", ErrorType = typeof(SPException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "a", ErrorCode = , Condition = "This list cannot be deleted because it has related lists with relationship behavior constraints.", 
    ErrorType = typeof(SPException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "listnotdeletable", ErrorCode = , Condition = "The list can not be deleted.", 
    ErrorType = typeof(SPException))]
public Guid Recycle()

Return Value

Type: System.Guid
A System.Guid object that identifies the list.

See Also

Reference

SPList Class

SPList Members

Microsoft.SharePoint Namespace