Delete all list items with Client Object model
-
16-10-2019 - |
Question
Is there any more efficient way of deleting al list items than getting all items and then deleting them one by one (item.DeleteObject())?
Solution
How about using the ProcessBatchData method? See this link for example.
OTHER TIPS
Jimbo is correct, ProcessBatchData is for the server API. However, the Client Object Model is more or less batch by default.
You must use DeleteObject( ) on each item, but as in all calls with the COM your commands are batched up and sent to the server only with ExecuteQuery( )
See here
You could use something like Fiddler to see the actual command, I'm not sure if the COM is smart enough to actually send a batch CAML delete or it's just a bundled bunch of single-object deletions.
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange