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?
The downside is that I have to do this on the server side with code rather than using CSOM or PS which was my preference. I work in an environment where deploying server side SP code is restrictive – and rightfully so. Do you know of a way to engage the batch processing from CSOM or PS?
Hello Denny,
Well, most of the references regarding your questions might be quite irrelevant. Mostly, people don’t realize that their c#/PS aren’t that efficient, continue copy-pasting quite doubtful code over and over from internet to production.
I would recommend to take a look on batching operation with SharePoint. The following post provides more context – Deleting all the items from a large list in SharePoint. The general idea is to utilise SPWeb.ProcessBatchData which consumes specific XML string to get some operation done. So that you might create an XML string with ListItem IDs to be deleted and it would work well.
The key point now is to understand how you may grab all the IDs to be deleted. You may consider ContentIterator class (also, take a look how it works within Reflector) to get safe iterations all over the big list.
That’s the basic ideas which might help to to get the right point in your solution.
Cheers.
Nope. There are rules around that library managed by the content organizer. It relies on that library so as long as that feature is turned on, the library cannot be removed.
Try the same approach through object model and it should work.
- Save list as template
- Delete list
- Recreate list from template
Thanks for the reply, but the Records Center “Drop Off Library” cannot be deleted. One of the “features” of the record center.