客户端对象模型 - 禁用事件触发

时间:2012-11-08 17:00:19

标签: sharepoint-2010

有没有办法在从托管客户端对象模型执行列表项更新时禁用事件触发?

在服务器模型中,我执行以下操作。但是,我找不到在Managed Client 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();
                        }

提前致谢。

1 个答案:

答案 0 :(得分:3)

您无法在客户端对象模型中执行此操作,请参阅SP.List对象上的MSDN文档:http://msdn.microsoft.com/en-us/library/ee554951。但是您可以开发自定义Web服务,该服务将从客户端调用并禁用事件触发。

相关问题