Create Remote Event Receivers in Share Point 2013
Remote event handlers new feature added in share point 2013. I have already published a post regarding event handling in share point 2013. In this post Iam showing how to create a remote event receiver through Visual studio.
here iam considering a requirement that update title of Announcement list, when ever new item added to the Announcement list. So that creating an app that contains Announcement list and adding remote event handler to the app. The process shown as below,
Create New Project–>Select SharePoint App in Visual Studio 2013.
App should be SharePoint-hosted
Check the AppManifest.xml file and tag
Add New item as list type of announcements , select list Item Type Events , select ItemAdded event as shown below
Add new item as Remote Event Receiver to the solution.
After adding the remote event receiver, you’ll get AppWeb project as shown in the image below. While creating Remote event receiver was selected list Item events and ItemAdded event.
Visual studio by default add the Appweb to the project, App web contains the service file that to run the web service. A Remote event receiver web service by default inherits from IRemoteEventService.
Remote event structure is different than regular event receivers. In regular event receivers we’ll over ride the existing methods Here in the Remote event handlers we’ll write the code in two methods, ProceeEvent() and ProcessOneWayEvent(). So the both the methods will handle the Synchronous and Asynchronous events rather than writing every method. Here we can simply called the method by checking SPRemoteEventProperties.EventType enumerator.
ProcessEvent() will return SPRemoteEventResult, shows the status and error message like other server side events. In this method for item event contains dictionaries for before and after properties, list, user information.
Here i took Item Added event. So that i need to add the code in ProcessOneWayEvent. I was added the following code in the method. After item added to the Announcement list title will be updated through my coding.
Here is the code in ProcessOneWayEvent() method.
public void ProcessOneWayEvent(RemoteEventProperties properties)
Uri myurl = new Uri(properties.ItemEventProperties.WebUrl);
if (properties.EventType == RemoteEventType.ItemAdded)
using (ClientContext clientContext = new ClientContext(myurl))
if (clientContext != null)
List lstContacts =
int cnt = lstContacts.ItemCount;
ListItem itemContact = lstContacts.GetItemById(cnt);
itemContact[“Title”] = itemContact[“Title”] + ” changed by Remote Event Receiver”;
xml in Elements.xml will be
Here Url is the WCF service url to run the event receiver.
Add the following code to default.aspx page, in “PlaceHolderMain” contentplaceholder to view the list in the app home page.
NoDefaultStyle=”TRUE” Title=”Announcements” PageType=”PAGE_NORMALVIEW”
Finally my default.aspx page will be,
Deploy the app and and you’ll be redirected to sharepoint app page that containes Announcement list.
Add new item to the announcement list. Title will be updated with ” changed by Remote Event Receiver”, in my next post i’ll write about app event handlers.
Provide comments below if you have any issues creating the event receiver.