Recently I wanted to delete all entries in a large list, but manually it was hectic and time consuming. One way could have been to delete and re-create that list, but that list was tightly bound to an InfoPath form, and I did not had any backup source available.
I had been experimenting in PowerShell these days, so looked around for any script which I could modify for my purpose.
Here is that script, took it from different sources mentioned here.
- Powershell: Efficiently empty large SharePoint lists
- SharePoint: Using PowerShell to Perform a Bulk Delete Operation
- How to delete all items in aList using PowerShell
Here is how you can use it.
Empty-List.ps1 -weburl [url of web] -listname [name of list]
My list was not too much big, I think I should re-modify it further to process items in multiple batches, and if possible also remove these items from recycle bin. I will post it separately.
Someone who dare not post himself, asked me what this ” > $null ” means at end of each statement.
Simply put it means we want to redirect the output to NULL, ignoring it or deleting it.
See here for details. http://technet.microsoft.com/en-us/library/hh849716.aspx