Delete undeletable list

I ran into a list without the "delete" link available in settings. Deletion also failed in designer. Afterwards, I was able to delete the list using the following code.

$sp = get-spweb "https://localhost/"
$list = $sp.lists.TryGetList("list")
$list.allowdeletion = $true
$list.update() 

It may take longer than expected for this operation to run!

You may also like