Saturday, May 11, 2013

Disable Delete List Option in SharePoint

What? We've a SharePoint list provisioned to store & retrieve custom application settings in a SharePoint site. Its critical to prevent this list from any accidental deletion, so we want to disable delete list option from list settings in SharePoint.

How? We can disable "Delete this list" link in SharePoint by setting the List or Library's AllowDeletion Property to "False". Once set, delete option will go hidden.

SharePoint list hide delete option
Disable delete in SharePoint list
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
#Get the web where the particular list lives
$web = Get-SPWeb ""
#Get the list
$list = $web.Lists["AppConfig"]
#Make the list 
$list.AllowDeletion = $false
Result: SharePoint delete list missing! sharepoint 2010 delete list missing
By this way, we stop users from deleting SharePoint lists. If you notice, in some of the SharePoint lists & libraries (E.g. "Farm Templates" library), "Delete this List" or "Delete this Document Library" links are missing by default to prevent delete option.

Revert the flag "AllowDeletion" to "True" programmatically, if you must delete a list that doesn't offer "Delete this list" link. Once this flag set to false, we can't delete it even programmatically! you will get "This list cannot be deleted." error if you try to delete it.

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.

Check out these SharePoint products:

No comments :

Post a Comment

Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...