In this short article, I will explain you about how to delete list and Libraries using PowerShell Script for SharePoint 2010 and SharePoint 2013. Now, Please Create CSV file with the following columns.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
Below Script you can use to delete list and libraries based on input CSV file. #Reading the CSV file $path = "c:\ListAndLib.csv" $csv = Import-csv -path $path foreach($line in $csv) { #Reading content type related information $siteURL = $line.SiteURL $listName = $line.ListName if ($siteURL -ne $null) { if ( (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null ) { Add-PSSnapin Microsoft.SharePoint.PowerShell } [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") | Out-null # Creating the instance for site $web = Get-SPWeb $siteURL $list = $web.Lists[$listName] if($list -ne $null) { $web.Lists.Delete([System.Guid]$list.ID) write-host -ForegroundColor Green $listname " list has been deleted successfully...." $web.Dispose() } } } |
I hope works out for you!
SharePoint 2013 Hosting Recommendation
HostForLIFE.eu’s SharePoint 2013 Hosting solution offers a comprehensive feature set that is easy-to-use for new users, yet powerful enough for the most demanding web developer expert. Hosted SharePoint Foundation 2013 is the premiere web-based collaboration and productivity enhancement tool on the market today. With SharePoint 2013 Foundation, you can quickly access and manage documents and information anytime, anywhere though a Web browser in a secure and user friendly way. SharePoint hosting services start at only at €9.99/mo, allowing you to take advantage of the robust feature set for a small business price. HostForLIFE.eu offers a variety of hosted SharePoint Foundation 2013 plans as well as dedicated SharePoint 2013 Foundation options.