Saturday, January 17, 2015

Remote event receiver in SharePoint 2013.

Quick glance on   Remote event receiver.

  • Remote event receiver can be attached to SharePoint list event , List item event.

When you add the remote event receiver item, Visual Studio 2012 adds the WCF service to your project as shown here.
After adding the remote event receiver template from the Visual studio to your project, a wcf service file .svc will be added to your web project and list type file will be added to your SharePoint App project.Click and choose the properties of the list type, select the desired events to be triggered on your SharePoint app.

  • Remote event triggered by web service (WCF) in which turn communicates with SharePoint and SharePoint send back to Access Control Service (Azure - AD or on premise AD) to get its token to be validated.

  • Once the token validates by the ACS,then remote event receiver starts to firing.
  • Remote Event receivers works only on Provider host not on SharePoint hosted app.

  • Remote event receiver can be debugged by configuring the Visual Studio 2012. On project select the SharePoint tab ,Check the "Enable remote event debugging".

To do this,you need to create the "Service Bus" service in Azure subscription. This is basically debug has to be run outside of your SharePoint environment and validate your Office 365 user authentication to trigger the event on SharePoint.

  • Remote event receiver supports synchronous and asynchronous using methods.

ProcessEvent (sync) method that takes SPRemoteEventProperties - Item Adding,deleting..etc parameter and
ProcessOneWayEvent (async) (SPRemoteEventProperties properties) - Item added,item deleted..