Cannot use ProcessBatchData without increasing version of processed item

I need to update SPListItem using web.ProcessBatchData, without creating a new version.

I tried using this xml:

<?xml version="1.0" encoding="UTF-8"?> <ows:Batch OnError="Continue"> <Method ID="1"> <SetList>{some-guid}</SetList> <SetVar Name="Cmd">Save</SetVar> <SetVar Name="ID">{list-item-id}</SetVar> <SetVar Name="owshiddenversion">{current-item-version}</SetVar> <SetVar Name="urn:schemas-microsoft-com:office:office#Title">some title</SetVar> </Method> </ows:Batch> 

After doing BatchData in this xml, I got a new version ({previous version} + 1) even without changing the element’s visible fields.

Is it possible to use ProcessBatchData in the same way as SystemUpdate (false)?

PS I need to update the list item. The previous xml mentioned works fine when updating DocumentLibrary elements ...

+4
source share
1 answer

A piece of cake :) lol

  using (var disabler = new DisabledEventFiringScope()) { web.ProcessBatchData(batchXml); } 

And here is the code for the DisabledEventFiringScope class:

 class DisabledEventFiringScope : SPEventReceiverBase, IDisposable { public DisabledEventFiringScope() { EventFiringEnabled = false; } public void Dispose() { EventFiringEnabled = true; } } 
0
source

Source: https://habr.com/ru/post/1342124/


All Articles