Ads

Monday, 27 June 2016

Remote Event Receiver SP 2013

A new concept, "Remote Event Receivers" has been introduced in SP 2013.

we could create SharePoint Apps (that is a standalone module of code that is complete in itself and can be installed / uninstalled independently on a Client) that can act as event generators.
Remote event receivers are written using web services.
 
Remote Event Receivers (RER) in SharePoint Online also have before events and after events. Also called as synchronous and asynchronous events.

Before events:
Modeled as two way events because SharePoint calls into the web service to notify that an event is happening and then it will wait for a response to decide further action. So, this is a blocking event for the user.
it impact the performance by network traffic. Also, this is not guaranteed to be executed like the workflow which uses service bus architecture.
So, we need to ensure this is a light weight operation we are trying to do.

After Event:
This uses the WCF service one way method, so its guaranteed that the will execute.
Here it just notifies the remote web of the event. It doesn’t block the SharePoint processes

Note: Remote event receivers are not supported by default in SharePoint hosted app since they cannot provide the remote endpoint. This is because they are restricted to only use JavaScript.

While creating RER using visual studio, there are two methods in the WCF service:
  1. ProcessEvent() 
    1. that handles events that occur before an action occurs, 
    2. This is a synchronous event (2-way that can handle "-ing" (current) events) that can call-back to SharePoint, for example cancelling an addition to a list
  2. ProcessOneWayEvent() 
    1. that handles events that occur after an action occurs, 
    2. This is an asynchronous event (1-way that can handle "-ed" (past) events, fire and forget type)






 Reference:  One  Two  Three    

No comments:

Post a Comment

Ads