Avoid Accidental Deletion of SharePoint List

One of my client requested a settings in SharePoint 2010 to avoid accidental deletion of Lists.
Indeed we can recover it from Recycle Bin within 30 days, but they need to avoid deletion. Alternatively we can make a permission settings to avoid deletion.

Let’s see how to do this using PowerShell.

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$web = Get-SPWeb -Identity 'http://domain.com/windows_test'
$list = $web.Lists['PowerShell']
$list | GM

6196305_orig

AllowDeletion is a Property which will allow us to set and get.

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$web = Get-SPWeb -Identity 'http://domaincom/windows_test'
$list = $web.Lists['PowerShell']
$list.AllowDeletion = $false
$list.Update()

3411834_orig

Reference Class
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splist.aspx

SharePoint 2010 : Query SharePoint List Items missing required fields.

In most of the organizations Content Managers decides the fields and its property for the List or Library. They are Power Users and have certain limitations to fetch reports.

We started discussing about Power Query and ended up in PowerShell.

Requirement:
Need to fetch Document Library Items which miss some required fields.

Scenario:
We all know that SharePoint will not allow us to submit the item if we miss the required fields. However in some cases content managers might have changed the settings and revert. During this interval we may have few items created with no required fields.

Code

$web = Get-SPWeb 'http://domain.com/subsite'
$list = $web.Lists["LibraryName"]
$data = $list.Items | ? {$_.MissingRequiredFields -eq $true}
$data | Select Title , MissingRequiredFields , ID | 
Export-Csv D:\MissingRequiredFields.csv -NoTypeInformation -Encoding UTF8