The list is a “Drop Off Library” in a Record Center site collection. I’m in the development phase and need to be able to add and remove 100k records at a time. I added 112k records via the OfficialFileCore object, and they didn’t route b/c I didn’t set up drop off library to use the correct content type. So when I go to remove the records, I’m getting errors that crash the system. The only script I’ve found was located here:
http://wp.ahcheng.com/2012/09/04/splistitem-delete-best-practise-sharepoint-splist/
This is the only one that will run without crashing the system. The other methods I’ve found have tried to load the SPItemCollection each time and it seems to be causing major memory problems. Is there a good way that doesn’t require major coding to simply tell SharePoint to “Clear this list of all splistitems”? Please?
I wrote this basic PowerShell script last year that uses the ProcessBatchData and compiles an XML instruction set to be processed instead of iterating through and deleting each item one by one for exactly the same reason when I was dealing with large amounts of test data being loaded and deleted from lists:
http://gallery.technet.microsoft.com/Truncate-all-Items-in-an-2841c740
Shoould work if you can open a PS session on the SP server and run it. it’s not very elegant but should be easy to modify for your needs.
You can do this using CSOM asynchronous batch, the key to my post is splitting each request into smaller chunks of around 1000, and chaining the requests. This is were my suggestion differs. Thus the slightly different approach to the batching algorithm presented on that page.
I would run a batch delete of around 1000 at a time using SPWeb.BatchProcessData.
I googled this for you: http://sharepoint.stackexchange.com/questions/39579/fastest-way-to-delete-all-items-with-c
Look at that article:
http://social.technet.microsoft.com/wiki/contents/articles/19036.sharepoint-using-powershell-to-perform-a-bulk-delete-operation.aspx
It is powershell only.
Cheers