2012-11-08 46 views
1

當從託管客戶端對象模型執行列表項更新時,是否有辦法禁用事件觸發?客戶端對象模型 - 禁用事件觸發

在服務器模型中,我執行以下操作。但是,我找不到在託管客戶端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(); 
         } 

在此先感謝。

回答

3

您無法在客戶端對象模型中執行此操作,請參閱SP.List對象上的MSDN文檔:http://msdn.microsoft.com/en-us/library/ee554951。但是您可以開發自定義的Web服務,這將從客戶端調用並禁用事件觸發。

+0

感謝您的回答 –

相關問題