Monday, 23 June 2014

How to delete a SharePoint list using Powershell

Reciently I had an issue with Manage Site & Content not working. After reading some blogs I determined that it could be a broken list causing the issue. Here is some Powershell to report all the lists. I used this report to determine if the list was broken by pasting the ID into the list settings page. Ie, http://sharepointSite/_layouts/listedit.aspx?List=IDHere. If the page didnt load the list was corrupted. The lists can also be tested by using SharePoint Manager 2010 and clicking through the lists.

List report PS:
$url = "http://SharePointSite"
$web = get-spweb $url
$web.lists | Select title, ID

This is the PS for actually deleting the corrupted list:
$list = $web.lists["ListName"]
$list.allowdeletion = $true
$list.update()
$list.delete()

No comments:

Post a Comment