3

I have a Farm Solution that management is pushing to be ported to the App Model. This Farm solution has a Custom Action which, when configured, dynamically attaches a ListItem Event Receiver to the List chosen by the user.

Is it possible to attach a Remote Event Receiver to a list programmatically ? Can you add a Remote Event Receiver to the Host Web or does it have to exist in the App Web attached to a list in the App Web?

3

For your question "Is it possible to attach a Remote Event Receiver to a list programmatically?, The answer is YES. Yes it is possible to attach the remote event receiver programmatically.

We can make use of EventReceiverDefinitionCreationInformation class to make this possible in AppInstalled event.

For your query there is perfect article written here

Let me know if you have any additional issue in implementing this.

  • when AppInstalled runs, I still won't know the List the user wants to attach the event receiver to. I will only know when they click a Custom Action link in the Ribbon or Settings (The user needs to choose the List) . Can you see a flow like this working? List Settings => Custom Action => AppWeb UI => RER => Attach RER to List ? – Colbs Jul 20 '16 at 14:06
  • Or maybe they can pick a List from a Drop down in the AppWeb UI, if I could query the Host web for all Lists – Colbs Jul 20 '16 at 14:07
  • We can always query the Host Web list in App Web. – Aakash Maurya Jul 21 '16 at 3:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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