Programmatically Disable Event Firing on List Item Update in SharePoint 2010
In this article you will see how to disable event firing on a list item update using the SharePoint Object Model.
In this article you will see how to disable event firing on a list item update using the SharePoint Object Model. I have a custom list in which an Item updated event receiver is implemented. Whenever an item is updated an email will be sent. But I want to update a few column values without firing the item updated event receiver. The following procedure needs to be followed to disable event firing on a list item update.
Create a Console Application using the following:
- Open Visual Studio 2010 by going to Start | All Programs | Microsoft Visual Studio 2010 | Right-click on Microsoft Visual Studio 2010 and click on Run as administrator.
- Go to the File tab, click on New and then click on Project.
- In the New Project dialog box, expand the Visual C# node, and then select the Windows node.
- In the Templates pane, select Console Application.
- Enter the Name as DisableEventFiring and then click OK.
- In the Solution Explorer, right-click on the solution and then click on Properties.
- Select the Application tab; check whether ".Net Framework 3.5" is selected for Target Framework.
- Select the Build tab; check whether "Any CPU" is selected for Platform Target.
- In the Solution Explorer, right-click on the References folder and click on Add Reference.
- Add the following reference.
- Right-click on the project, select Add and click on New Item.
- In the templates pane, select Class.
- Enter the Name as EventFiring and then click OK.
- Replace EventFiring.cs with the following code:
public classEventFiring : SPItemEventReceiver
public void DisableHandleEventFiring()
public void EnableHandleEventFiring()
- Replace Program.cs with the following code:
static void Main(string args)
using (SPSite site = new SPSite("https://serverName/sites/Vijai/"))
using (SPWeb web = site.OpenWeb())
SPList list = web.Lists.TryGetList("Custom");
SPListItem item = list.GetItemById(34);
item["Title"] ="Updated Successfully";
EventFiring eventFiring = newEventFiring();
- Hit F5.
- The item is updated successfully without firing the item updated event receiver.
Thus in this article you have seen how to disable event firing on a list item update using the SharePoint Object Model.