Event Receiver in SharePoint 2013

Event receivers in Microsoft SharePoint Foundation 2010 enable your custom code to respond when specific actions occur on a SharePoint object.

Event receiver: An event receiver in Microsoft SharePoint Foundation 2010 is simply a method that is called when a triggering action occurs on a specified SharePoint object. Triggering events include actions such as adding, updating, deleting, moving, checking in and checking out.

SharePoint objects that listen for events, that is, event receiver hosts, include objects such as site collections, sites, lists and workflows.
Events are valuable tools for SharePoint developers. When a user does an action that affects a SharePoint site, you can trap that action and respond to it with custom code.

For example, if a project manager needs to be alerted when new documents or files are added to a given Document Library, you could write event receiver code to send an e-mail notification to the project manager and then bind that code to the item-addition action on the Document Library.

SharePoint Foundation 2010 provides enormous flexibility for detecting and responding to SharePoint events.

An event receiver is a piece of managed code that responds to SharePoint events when specific triggering actions occur on a SharePoint object. Triggering actions include activities such as adding, updating, deleting, moving, checking in and checking out. 

Synchronous Events: This event is executed in the same thread in which the triggering action is occurring. For example, when the user adds an item from the SharePoint user interface, the event is fully executed before returning to the user and showing that the item was added.

Asynchronous Events: This event occurs at a later time than the action that triggered it and it executes on a thread that is different from the one in which the triggering action is running. These are after events.

Class for SharePoint events

Base: Microsoft.SharePoint.SPEventReceiverBase.

List Item: Microsoft.SharePoint.SPItemEventReceiver

SharePoint List: Microsoft.SharePoint.SPListEventReceiver

Email: Microsoft.SharePoint.SPEmailEventReceiver





Refrence: MSDN

Up Next
    Ebook Download
    View all
    Learn
    View all