In this tutorial, I will explain how to create a remote event receiver in SharePoint Online using Visual Studio. I will also show you how to deploy the event receiver to Microsoft Azure for SharePoint Online.
Note: The SharePoint Add-In model in SharePoint Online has been deprecated as of November 27th, 2023. Deprecation means that the feature will not get any new investments, but it’s still supported. The SharePoint add-in model will be fully retired on April 2, 2026, and will no longer be available after that date. The primary replacement technology for the SharePoint add-in model is SharePoint Framework (SPFx), which will continue to be supported in the future.
If you are planning to develop remote event receivers now, I will not recommend it; instead, use SPFx.
Remote Event Receiver in SharePoint Online
Remote Event Receivers (RERs) are components in SharePoint Online that handle events such as when items are added, updated, or deleted in SharePoint lists and libraries.
Remote Event Receivers rely on a SOAP communication channel that allows an external service to receive notifications when events occur in SharePoint. These events can be either synchronous or asynchronous, depending on the implementation needs.
Unlike traditional server-side event receivers used in on-premises SharePoint, RERs are external web services that run outside of SharePoint, making them suitable for the SharePoint Online environment.
Create a Remote Event Receiver in SharePoint Online
Follow the steps below to create a remote event receiver in SharePoint Online using Visual Studio.
- Open Visual Studio and then File -> New Project. Then in the New Project dialog box, choose Templates -> Visual C# -> Office/SharePoint and from there choose App for SharePoint like below. Provide a name and ensure that the .NET Framework version is set to 4.5.

- Then, choose a SharePoint developer site and select Provider-hosted, as shown below.

- Then it will ask to give credentials for the developer site, and then it will automatically select the SharePoint version, like below:

- Then in the web project type, select whether you want to create an ASP.NET Web Forms Application or “ASP.NET MVC Web Application“, like below. Here, we will choose ASP.NET Web Forms Application.

- Then choose “Use Windows Azure Access Control Service (for SharePoint cloud apps)” in the Configure authentication settings, as shown below:

- Visual Studio will take some time and create two projects: one for the Add-in and another for the ASP.NET Web project, as shown below.

- Now select the Add-in project and from the properties, set True to “Handle App Installed” like below:

- Once you make the property true, it will add an AppEventReceiver.svc file inside the Services folder, as shown below. In this class, we will handle the AppInstalled and AppUninstalling events.

- Then we will add our remote event receiver class. For this, right-click on the Add-in project (first project) and then Add -> New Item.

- Here, choose Remote Event Receiver in the Add New Item dialog box.

- Then choose List Item Events, event source as Custom List, and then event as “An Item was added”.

- Once you add the remote event receiver, the .svc (RemoteEventReceiver1.svc) file will be added into the App project as well as inside the Services folder inside the Web project, like below:

- Here is my host web. I have added a SharePoint list with a Title and Description column. When a user adds an item to the list, they will enter the Title, and the Description will be populated from the remote event receiver. The list looks like this:

Now we need to generate the ClientId and ClientSecret. So navigate to the _layouts/15/appregnew.aspx page
Example: https://<tenantname>.sharepoint.com/sites/MyO365DevSite/_layouts/15/appregnew.aspx
They click on the Generate button for the Client ID and Client Secret fields. Then, give a title and Domain, and enter the website that we created in Azure (without https://). And the Redirect URI, put the website URL, make sure to give in https:
Here, the page looks like the following:

Then open the web.config file and replace the ClientId and ClientSecret, which we have generated in the above page.
It looks like this:

Now open the AppManifest.xml file and give full control to the Site Collection like below:

Also, we need to add the ClientId in the AppManifest.xml file. Right-click on the AppManifest.xml file and select ‘View Code’. In the warning box, click “Yes” to open the code file.

There, add the ClientId in RemoteWebApplication inside the AppPrincipal tag. AppManifest.xml looks like this:

AppEventReceiver Code:
In the AppEventReceiver file, we need to add the code to attach the event receiver to the host list. The code will be added to the ProcessEvent event. Here we are adding the AppInstalled and AppUninstalling event.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint.Client;
using Microsoft.SharePoint.Client.EventReceivers;
using System.Reflection;
namespace DemoSharePointRERWeb.Services
{
public class AppEventReceiver : IRemoteEventService
{
/// <summary>
/// Handles app events that occur after the app is installed or upgraded, or when app is being uninstalled.
/// </summary>
/// <param name=”properties”>Holds information about the app event.</param>
/// <returns>Holds information returned from the app event.</returns>
public SPRemoteEventResult ProcessEvent(SPRemoteEventProperties properties)
{
SPRemoteEventResult result = new SPRemoteEventResult();
if (properties.EventType == SPRemoteEventType.AppInstalled)
{
using (ClientContext clientContext = TokenHelper.CreateAppEventClientContext(properties, false))
{
if (clientContext != null)
{
//Get reference to the host web list with name Feedback
var documentsList = clientContext.Web.Lists.GetByTitle(“DemoRemoteEventReceiverList”);
clientContext.Load(documentsList);
clientContext.ExecuteQuery();
string remoteUrl = “https://enjoysharepoint.azurewebsites.net/Services/RemoteEventReceiver1.svc”;
//Create the remote event receiver definition
EventReceiverDefinitionCreationInformation newEventReceiver = new EventReceiverDefinitionCreationInformation()
{
EventType = EventReceiverType.ItemAdded,
ReceiverAssembly = Assembly.GetExecutingAssembly().FullName,
ReceiverName = “RemoteEventReceiver1”,
ReceiverClass = “RemoteEventReceiver1”,
ReceiverUrl = remoteUrl,
SequenceNumber = 15001
};
//Add the remote event receiver to the host web list
documentsList.EventReceivers.Add(newEventReceiver);
clientContext.ExecuteQuery();
}
}
}
else if (properties.EventType == SPRemoteEventType.AppUninstalling)
{
using (ClientContext clientContext = TokenHelper.CreateAppEventClientContext(properties, false))
{
var list = clientContext.Web.Lists.GetByTitle(“DemoRemoteEventReceiverList”);
clientContext.Load(list);
clientContext.ExecuteQuery();
EventReceiverDefinitionCollection erdc = list.EventReceivers;
clientContext.Load(erdc);
clientContext.ExecuteQuery();
List<EventReceiverDefinition> toDelete = new List<EventReceiverDefinition>();
foreach (EventReceiverDefinition erd in erdc)
{
if (erd.ReceiverName == “RemoteEventReceiver1″)
{
toDelete.Add(erd);
}
}
//Delete the remote event receiver from the list, when the app gets uninstalled
foreach (EventReceiverDefinition item in toDelete)
{
item.DeleteObject();
clientContext.ExecuteQuery();
}
}
}
return result;
}
/// <summary>
/// This method is a required placeholder, but is not used by app events.
/// </summary>
/// <param name=”properties”>Unused.</param>
public void ProcessOneWayEvent(SPRemoteEventProperties properties)
{
throw new NotImplementedException();
}
}
}RemoteEventReceiver1 code:
In the remote event receiver code, we will write the code that will handle the ItemAdded event.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint.Client;
using Microsoft.SharePoint.Client.EventReceivers;
namespace DemoSharePointRERWeb.Services
{
public class RemoteEventReceiver1 : IRemoteEventService
{
/// <summary>
/// Handles events that occur before an action occurs, such as when a user adds or deletes a list item.
/// </summary>
/// <param name=”properties”>Holds information about the remote event.</param>
/// <returns>Holds information returned from the remote event.</returns>
public SPRemoteEventResult ProcessEvent(SPRemoteEventProperties properties)
{
SPRemoteEventResult result = new SPRemoteEventResult();
using (ClientContext clientContext = TokenHelper.CreateRemoteEventReceiverClientContext(properties))
{
if (clientContext != null)
{
clientContext.Load(clientContext.Web);
clientContext.ExecuteQuery();
}
}
return result;
}
/// <summary>
/// Handles events that occur after an action occurs, such as after a user adds an item to a list or deletes an item from a list.
/// </summary>
/// <param name=”properties”>Holds information about the remote event.</param>
public void ProcessOneWayEvent(SPRemoteEventProperties properties)
{
// On Item Added event, the list item creation executes
if (properties.EventType == SPRemoteEventType.ItemAdded)
{
using (ClientContext clientContext = TokenHelper.CreateRemoteEventReceiverClientContext(properties))
{
if (clientContext != null)
{
try
{
string title = properties.ItemEventProperties.AfterProperties[“Title”].ToString();
List lstDemoeventReceiver = clientContext.Web.Lists.GetByTitle(properties.ItemEventProperties.ListTitle);
ListItem itemDemoventReceiver = lstDemoeventReceiver.GetItemById(properties.ItemEventProperties.ListItemId);
itemDemoventReceiver[“Description”] = “Description from RER :: “+title;
itemDemoventReceiver.Update();
clientContext.ExecuteQuery();
}
catch (Exception ex) { }
}
}
}
}
}
}Check out Windows Server Roles And Features Cannot Be Automatically Installed
Deploy Remote Event Receiver in SharePoint Online to Microsoft Azure
Now we need to deploy the remote event receiver.
Right-click on the web project and then click on Publish, like below:

In the Publish Web project, click on Microsoft Azure Web Apps as shown below:

Here, log in to the Azure account, and it will display all the web apps. Choose the particular web apps like below:

Then it will display the Publish Web screen with the Publish method, Server, Site name, Username, Password, and Destination URL. Do the “validate connection” and once it is successful. Then click on Next.

Then click on the Next as shown in the fig below:

You can also click on the Start Preview button to see the preview.

Then right-click on the Add-in Project and click on Publish, like below:

Then, in the Publish your app page, click on the Edit button like below:

Then, enter the ClientId and Client Secret that we created in the previous step. It looks like this:

Now, click on the Deploy your web project again, like below:

Once the web project is deployed successfully, click on the Package the app as shown below:

Here, the website will be populated by default, and the clientId will also be populated by default, like below. Click the Finish button to generate the .app file.

Once the .app file is ready, we will deploy the .app file to the Apps in a Testing list on the developer site.

Once the app is installed successfully, open the list and add an item to it. We will only add the Title, and the description will be populated by the remote event receiver, as shown in the figure below:

I hope you got an idea of remote event receivers in SharePoint Online. I have explained how to create a remote event receiver in SharePoint Online using Visual Studio. I have also explained how to deploy the remote event receivers to Microsoft Azure.
You may also like:
- Connect to SharePoint Online Using PowerShell
- This Edition Cannot Be Upgraded Error in Windows Server
- Turn Off Microsoft Authenticator App in Microsoft 365
- SharePoint User Information List

After working for more than 18 years in Microsoft technologies like SharePoint, Microsoft 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (12 times). I have also worked in companies like HP, TCS, KPIT, etc.