Question

Is it possible to associate/register a remote (provider-hosted) event receiver with a custom list that is not part of a provider-hosted app (e.g. the list is on a site, but is not within an app)?

If so, where do I go within my site to register and configure the event receiver?

If not, what are my options if I need more than one app to access the same list (via REST) and in doing so, trigger the event receiver?

Was it helpful?

Solution

You want to attach a remote event receiver to a list in the host web? You have to run some code in order to do that. It can be done from an App Installed event, through your site provisioning process, through PowerShell, or whatever.

an example:

EventReceiverDefinitionCreationInformation receiver = new EventReceiverDefinitionCreationInformation();  

 receiver.EventType = erType;              //EventReceiverType Enum
 receiver.ReceiverUrl = receiverUrl;       //the url to the service .svc
 receiver.ReceiverName = eventHandlerName; //give it a name
 receiver.Synchronization = erSync;        //EventReceiverSynchronization Enum
 myList.EventReceivers.Add(receiver);
 clientContext.ExecuteQuery();

Some more info, Courtesy Kirk Evans.... http://blogs.msdn.com/b/kaevans/archive/2014/02/26/attaching-remote-event-receivers-to-lists-in-the-host-web.aspx

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top