我需要使用 web.ProcessBatchData 更新 SPListItem 而不创建新版本。
我试过使用这个 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>
在此 xml 上执行 BatchData 后,即使没有更改任何可见项目字段,我也收到了新版本 ({previous-version} + 1)。
是否可以以与 SystemUpdate(false) 相同的方式使用 ProcessBatchData?
附言我需要更新列表项。前面提到的 xml 可以完美地更新 DocumentLibrary 项目......
最佳答案
一块蛋糕 :) 哈哈
using (var disabler = new DisabledEventFiringScope())
{
web.ProcessBatchData(batchXml);
}
这是 DisabledEventFiringScope 类的代码:
class DisabledEventFiringScope : SPEventReceiverBase, IDisposable
{
public DisabledEventFiringScope()
{
EventFiringEnabled = false;
}
public void Dispose()
{
EventFiringEnabled = true;
}
}
关于sharepoint - 不能在不增加处理项目版本的情况下使用 ProcessBatchData,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5181610/