Event Reciever ItemUpdated fired twice

避免Update事件触发两次

public override void ItemUpdated(SPItemEventProperties properties)
  {  
    //base.ItemUpdated(properties);
    base.EventFiringEnabled = false;
    item.Update();
    base.EventFiringEnabled = true;
  }

//In Document library event handlers during Item Updating also checking that Document is it in Check In mode or Check Out. That's why it is called twice.

 public override void ItemUpdating(SPItemEventProperties properties)
  {  
    base.ItemUpdating(properties);
    if (properties.AfterProperties["vti_sourcecontrolcheckedoutby"] == null && 
        properties.BeforeProperties["vti_sourcecontrolcheckedoutby"] != null)
     {
       //do stuff
     }
  }

猜你喜欢

转载自www.cnblogs.com/jackhu88/p/9210088.html