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
     }
  }

 

posted @ 2018-06-21 17:21  JackHu88  阅读(127)  评论(0编辑  收藏  举报