2

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?

1 Answer 1

4

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.