SPList.Delete Method
Deletes the list.
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online
Syntax
'Declaration
<ClientCallableExceptionConstraintAttribute(FixedId := "a", ErrorCode := , Condition := "This list cannot be deleted because it has related lists with relationship behavior constraints.", _
ErrorType := GetType(SPException))> _
<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 := "accessdenied", Condition := "User does not have permissions to update this list.", _
ErrorType := GetType(UnauthorizedAccessException))> _
<ClientCallableMethodAttribute(Name := "DeleteObject", RemoveThisObjectFromParentCollection := True)> _
<ClientCallableExceptionConstraintAttribute(FixedId := "listnotfound", ErrorCode := , Condition := "The list is not found.", _
ErrorType := GetType(SPException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "listnotdeletable", ErrorCode := , Condition := "The list can not be deleted.", _
ErrorType := GetType(SPException))> _
Public Sub Delete
'Usage
Dim instance As SPList
instance.Delete()
[ClientCallableExceptionConstraintAttribute(FixedId = "a", ErrorCode = , Condition = "This list cannot be deleted because it has related lists with relationship behavior constraints.",
ErrorType = typeof(SPException))]
[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 = "accessdenied", Condition = "User does not have permissions to update this list.",
ErrorType = typeof(UnauthorizedAccessException))]
[ClientCallableMethodAttribute(Name = "DeleteObject", RemoveThisObjectFromParentCollection = true)]
[ClientCallableExceptionConstraintAttribute(FixedId = "listnotfound", ErrorCode = , Condition = "The list is not found.",
ErrorType = typeof(SPException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "listnotdeletable", ErrorCode = , Condition = "The list can not be deleted.",
ErrorType = typeof(SPException))]
public void Delete()
Remarks
This method also sets the status of the lists represented by the Lists property as modified.