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

Sunday, 22 June 2014

How to display error messages and the stack trace on the screen in SharePoint

You will need to make alterations to the web.config file usually located at C:\inetpub\wwwroot\wss\VirtualDirectories

NOTE: To help you find the location of the web.config file if its not in the location above you can open server manager -> IIS Manager -> Sites then right click on the site and select explore.

First turn off custom errors:


Second turn on stack trace:


Third, enable debugging:


Finally, enable tracing:


Make sure this is only done in you DEV environment as this will display config and security info to people browsing the site, it will also effect performance of your SharePoint site.