从托管客户端对象模型进行列表项更新时,有没有办法禁用事件触发?
在服务器模型中,我执行以下操作。但是,我找不到在托管客户端 ObjectModel 上执行相同操作的方法:
class DisabledEventsScope : SPItemEventReceiver, IDisposable
{ // Boolean to hold the original value of the EventFiringEnabled property
bool _originalValue;
public DisabledEventsScope()
{
// Save off the original value of EventFiringEnabled
_originalValue = base.EventFiringEnabled;
// Set EventFiringEnabled to false to disable it
base.EventFiringEnabled = false;
}
public void Dispose()
{
// Set EventFiringEnabled back to its original value
base.EventFiringEnabled = _originalValue;
}
}
using (DisabledEventsScope scope = new DisabledEventsScope())
{
// State-changing operation occurs here.
spItem.Update();
}
提前致谢。