Disable Event firing while updating List Items

Leave a Comment
Hello Everyone,

In a following post we will see how to disable event firing when you  are performing Update() on that List,here I am creating "DisableEventFiring" class which is Inheriting SPItemEventReceiver.

public class DisableEventFiring : SPItemEventReceiver
    {
       public void DisableHandleEventFiring()
        {
           this.EventFiringEnabled =false;
        }
       public void EnableHandleEventFiring()
        {
           this.EventFiringEnabled =true;
        }
    }
How to Use:
DisableEventFiring eventFiring = new DisableEventFiring();
eventFiring.DisableHandleEventFiring();
itemToUpdate.Update();
eventFiring.EnableHandleEventFiring();

Related Post

0 comments:

Post a Comment