Sunday 6 March 2016

Cannot Delete SharePoint List

Hi Friends,

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()

Thanks for reading this post..

See you than...

No comments:

Post a Comment