Home
> Paul Busby, Work > Programmatically Disable Event Firing on List Item Update in SharePoint 2010
Programmatically Disable Event Firing on List Item Update in SharePoint 2010
All credit to the original post here
The short version for my future reference is
Create a simple class
public classEventFiring : SPItemEventReceiver { public void DisableHandleEventFiring() { this.EventFiringEnabled =false; } public void EnableHandleEventFiring() { this.EventFiringEnabled =true; } }
Then use this to disable events
using (SPWeb web = site.OpenWeb()) { SPList list = web.Lists.TryGetList("Custom"); SPListItem item = list.GetItemById(34); item["Title"] ="Updated Successfully"; EventFiring eventFiring = newEventFiring(); eventFiring.DisableHandleEventFiring(); item.Update(); eventFiring.EnableHandleEventFiring(); Console.WriteLine("Updated Successfully"); Console.ReadLine(); } }
via Buzz Blog http://paulbuzzblog.wordpress.com/2013/09/19/programmatically-disable-event-firing-on-list-item-update-in-sharepoint-2010/
Paul is a an expert SharePoint and Project Server developer and is responsible for designing and implementing custom solutions on client systems using the latest SharePoint and .NET technologies.
Paul has extensive experience with SharePoint systems across all sizes of implementation, ranging from small to large farms and has an excellent understanding of all the elements of SharePoint. This article has been cross posted from paulbuzzblog.wordpress.com (original article) |
Categories: Paul Busby, Work
Development, Project Server, SharePoint
Comments (0)
Trackbacks (0)
Leave a comment
Trackback