แก้ไข

Replace event receivers in sandbox solutions

The SharePoint Add-in portions of this article are legacy guidance. The retirement below doesn't retire the other APIs or platforms discussed here.

Important

SharePoint Add-ins reached end of life in SharePoint Online on April 2, 2026. Both SharePoint-hosted and provider-hosted Add-ins are retired and no longer work in SharePoint Online, including government clouds. Add-in development, deployment, and usage guidance is retained for historical reference and for applicable SharePoint Server scenarios, not for new SharePoint Online solutions.

SharePoint Server Add-ins deployed through an on-premises app catalog are not retired by this change. Acquiring SharePoint Add-ins from the public marketplace ended on April 2, 2026 for SharePoint Server.

This retirement does not retire SharePoint REST APIs, CSOM, JSOM, or SharePoint Framework (SPFx). For SharePoint Online, use SPFx for user interface extensions and Microsoft Entra ID for authentication to external applications. See the retirement announcement and Add-in migration guidance.

The approach you take to handle events in SharePoint is slightly different in the SharePoint Add-in model than it was with Full Trust Code or in coded-sandbox solutions. In typical previous solutions, event receivers were created by using the SharePoint Server-Side Object Model and deployed via solutions packages, which executed the code on the SharePoint servers.

In the SharePoint Add-in model, however, the event receiver implementation executes on the web server that is hosting the event receiver; these are called remote event receivers (RERs). Event receivers can in many cases be replaced with a remote event receiver implementation.

This article describes various options and design considerations.

Note

Code-based sandbox solutions were deprecated in 2014, and SharePoint Online has started the process to completely remove this capability. Code-based sandbox solutions are also deprecated in SharePoint 2013 and in SharePoint 2016.

Options for replacing event receivers

Approach Design considerations and more information
Remote event receiver
  • Requires hosting infrastructure.
  • Hosting infrastructure must be highly available.
  • The service endpoint that hosts the remote event receiver must be configured for anonymous authentication.
  • Requires a trusted third-party certificate if you are using SharePoint Online.
  • Not intended for long running operations.
  • Remote event receivers that are attached outside the context of add-ins, attached by using a console application or PowerShell, will not receive a SharePoint context token when invoked, and you must defer to add-in-only permissions or use the SharePointOnlineCredentials class.
  • There is no retry mechanism.
Webhooks
  • Require hosting infrastructure.
  • Hosting infrastructure must be highly available.
  • Do not support synchronous events.
  • Process changes after the event has occurred.
  • Not available in SharePoint on-premises builds at this time.
Remote timer job to monitor changes
  • Uses the ChangeQuery object to monitor a site or list for modifications. This pattern is an alternative to remote event receivers.
  • Requires a hosting infrastructure.
  • Processes changes after the event has occurred.
  • Uses a polling mechanism to process changes.

Removing sandbox code from your site

When you deactivate your existing sandbox solution from your sites, any assets or files deployed by using declarative options are not removed. However, the features in the sandbox solution are automatically deactivated and the event receiver is removed.

See also