Reputation: 1
I’m trying to perform a batch delete operation on SharePoint 2007/2010.
When I execute the following using the List.asmx -> UpdateListItems I get mixed behavior:
`<Batch OnError="Return" PreCalc="TRUE">
<Method ID="87c970a3000c4e789a9c49ed43768865" Cmd="Delete">
<Field Name="ID">18</Field>
<Field Name="FileRef">
http://vs-dev-sp2010/list1/DocLib/New
Document-2.docx</Field>
</Method>
<Method ID="46e335183be64367a34c178772a86d92" Cmd="Delete">
<Field Name="ID">6</Field>
<Field Name="FileRef">
http://vs-dev-sp2010/ list1/DocLib /New
Document.docx</Field>
</Method>
</Batch>`
The operation on the first item succeeds (it is deleted), the second fails (it is checked out to another user). This makes it very difficult (impossible?) to rollback the transaction, as deleted items take version history, author, and created date/times to the grave with them. Because SharePoint allows you to ‘turn off’ the Recycle bin, the deleted item(s) could be gone for good. I expected SharePoint to rollback the failed operation and return either success or failure for the entire batch; however the behavior I’m observing is that the transaction partially succeeds.
I’m also observing that if the above items are in a container (folder) the entire batch fails (and this is the behavior I was expecting).
Enforcing pessimistic concurrency is not an option because checking out files cannot be batched (and there are potentially thousands of files in the batch). Even if it was possible to batch a checkout, the checkout operation itself could potentially trigger custom workflows.
Does anyone know of a property which would enforce atomic behavior of batch delete operations on SharePoint, see a flaw in the request I’m sending up, or have a better solution for batch deleting items?
Upvotes: 0
Views: 1221
Reputation: 9239
Unfortunately transactions are not supported on Sharepoint lists, and from my experience there is no easy, generic way for achieving this behaviour.
For what I understand, your question comes down to similar one, What is the workaround for missing transactions. Maybe that can be a good point to start for developers who look for their answer here.
Upvotes: 1