3

There are a few lists in a SharePoint Server 2010 development environment that are broken. Due to this situation, clicking the lists in the SharePoint Web interface throw .NET exceptions, and viewing lists and libraries in SharePoint Designer shows nothing. The normal solution to this situation is to delete those lists using PowerShell. This has worked previously, but is not working this time around. Each time, it gives the error

Exception calling "Delete" with "0" argument(s): "This list cannot be deleted."
At line:1 char:15
+ $custom.Delete <<<< ()
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

Is there a way to delete these lists, via PowerShell or some other method?

Thank you in advance for your help and advice!

1 Answer 1

7

First try this set of commands:

$web = Get-SPWeb http://web-url
$list = $web.Lists["Documents"]
$list.AllowDeletion = $True
$list.Update()

and then

$web = Get-SPWeb http://web-url
$custom = $web.lists["Documents"]
$custom.Delete()
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.