Question

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!

Was it helpful?

Solution

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()
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top