Cannot Delete SharePoint List

By James|02/26/2012|,

When cleaning up your portal, you may run across a list that will not delete.  List settings will not show the "Delete this list" option or ribbon button.  Using SharePoint Designer to delete the list results in "Unable to save changes. This list cannot be deleted".  The cause of this headache inducing behavior is that the list was created with the "Allow Deletion" flag set to FALSE.  This may have been done by a web part, solution or your friendly developer.  In any case, we can use some PowerShell Kung-Fu to get rid of the list.

Let's say the portal URL is http://myportal and the offending list is named "MyList".  The following PowerShell commands will delete the "undeletable" list.

$Web = Get-SPWeb http://myportal
$List = $Web.Lists["MyList"]
$List.AllowDeletion = $TRUE
$List.Update()
$List.Delete()
$Web.Dispose()

 

Copyright 2011 - 2024 The Lazy IT Admin | All Rights Reserved
menu-circlecross-circle linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram