Monday, February 13, 2012

Problems deleting a Sharepoint 2010 list

You can use the Powershell command below to delete a list, however if you get an error  in the form of "This list cannot be deleted." then go to Step B and try Step A again.

Step A - try to delete a list
$w = Get-SPWeb "http://myweb"
$w.Lists.Delete([System.Guid]$w.Lists["My List Name"].ID)
Step B - toggle list cannot be deleted error
$w = Get-SPWeb "http://myweb"
$list = $w.Lists["My List Name"]
$list.AllowDeletion = $True

The delete command will now be visible on your list settings again and you'll run the line below:

Blog Ref:

No comments: