David
David

Reputation: 116

Remote Event Receiver not firing when created using App Context

When I create a remote event receiver for the list added event using an App Context the endpoint doesn't get called when a user adds a list or library using the UI, however when I create the event receiver with a user context it does get called

I can list the event receivers and the one I have created is there and looks correct

Example Code, where the event receiver doesn't fire

var am = new AuthenticationManager();
using (var cc = am.GetAzureADAppOnlyAuthenticatedContext(siteUrl, ClientId, Tenant, CertificatePath, CertificatePassword))
{
cc.Web.AddRemoteEventReceiver("ListAddedFunction", "https://redacted.ngrok.io/api/ListAddedFunction", EventReceiverType.ListAdded, EventReceiverSynchronization.Asynchronous, false);
}

If I replace the client context creation with

using (var cc = authManager.GetWebLoginClientContext(siteUrl))

then the endpoint is called as expected

Upvotes: 0

Views: 382

Answers (1)

SvenC
SvenC

Reputation: 101

You might need to call appinv.aspx for the appId (or clientId) of your app registration to get SharePoint to call the RER, have a look at this issue for details:

https://github.com/SharePoint/sp-dev-docs/issues/4381

Upvotes: 1

Related Questions