Forum Discussion

john john's avatar
john john
Iron Contributor
Jul 23, 2019

Documentation on how to create and debug a remote event receiver and attach it to existing list

I have a custom list inside our SharePoint online,and it contain many items. now i want to add some business logic to the list through implementing a remote event receiver which get fired when items are been created and edited. but i am not sure how i can attach a remote event receiver to existing list? last time i did so was around 3 years ago, where i follow the steps mentioned on this link and they worked well for me @ Attaching Remote Event Receivers to Lists in the Host Web . but recently when i tried this appraoch, i got an error related to the fact that azure service bus (which will be used to debug the RER) has been retired and can not used any more to debug remote event receivers. now i found this link Remote Event Receivers Creating and Debugging in SharePoint Online, but it does not show how to attach the remote event receiver to existing list, as in this link they added a new list as part of the remote event receiver project... so can anyone help me in finding a full documentation on how we can create and debug a remote event receiver and attach it to existing list in sharepoint online? as all the articles i have read are using old approaches which have been retired (especially for debugging the RER using azure service bus!!)..

Thanks

4 Replies

  • RobElliott's avatar
    RobElliott
    Silver Contributor

    john john, things have moved on in the last 3 years and the modern approach to setting actions that take place when an item is created or modified in a SharePoint list is to use Microsoft Flow which has now been around for 2 years. You have connectors to over 250 Microsoft Office and non-Microsoft apps, a huge range of actions that you can perform, it handles conditions, parallel branching and approvals, you've got variables, a large range of expressions and so much more.

     

    So, for example, you'd have a SharePoint trigger of "When an item is created or modified" for a particular list, and the following action could be "start and wait for an approval" which sends an approval request to an approver who approves or rejects and adds comments right in their email without needing to go into SharePoint. Then the SharePoint item is updated with the decision, who made it, the date and any comments from the approver. You could then have a condition that if the decision was Approve an email is sent to the person who added the new item, but if it's Reject then a different email is sent.

     

    That's a simple (it takes less than 15 minutes to build) but very common example of how Flow is used every day to automate repetitive tasks and add business logic. It's a brilliant app and I recommend you investigate it.

     

    Rob
    Los Gallardos
    Microsoft Flow Community Super User

    • john john's avatar
      john john
      Iron Contributor

       


      RobElliott wrote:

      john john, things have moved on in the last 3 years and the modern approach to setting actions that take place when an item is created or modified in a SharePoint list is to use Microsoft Flow which has now been around for 2 years. You have connectors to over 250 Microsoft Office and non-Microsoft apps, a huge range of actions that you can perform, it handles conditions, parallel branching and approvals, you've got variables, a large range of expressions and so much more.

       

      So, for example, you'd have a SharePoint trigger of "When an item is created or modified" for a particular list, and the following action could be "start and wait for an approval" which sends an approval request to an approver who approves or rejects and adds comments right in their email without needing to go into SharePoint. Then the SharePoint item is updated with the decision, who made it, the date and any comments from the approver. You could then have a condition that if the decision was Approve an email is sent to the person who added the new item, but if it's Reject then a different email is sent.

       

      That's a simple (it takes less than 15 minutes to build) but very common example of how Flow is used every day to automate repetitive tasks and add business logic. It's a brilliant app and I recommend you investigate it.

       

      Rob
      Los Gallardos
      Microsoft Flow Community Super User


      RobElliottthanks for the reply. i already know about Flow but have not use it before.. but this is the first time i hear that Flow will be a replacement for RER...  as in the on-premises case we did not view Microsoft workflows as a replacement for server-side Remote event receivers.. also i am not sure if flow will allow handling events such as Adding/Editing.. As you described a scenario which is supported by Flow out of the box, let me share a scenario which i use to do inside SP on-premises using server side ER:- Now before adding/editing an item i will check if the user who is performing the action is inside certain sharepoint group (a sharepoint group equal a field in the item which is been added/edited) >> if the user exists i will proceed with the add/edit >> if the user does not exists i will cancel the operation.. i have many scenarios like these to implement custom permissions, and now i want to migrate them to sharepoint online, so the way i am viewing this, is that i will migrate my Adding/Editing server-side ER to be Adding/editing Remote ER,, not sure if flow can help us in this case.

      Thanks in advance for your help.

    • john john's avatar
      john john
      Iron Contributor

       


      Trevor Seward wrote:
      Take a look at using webhooks instead:

      https://docs.microsoft.com/sharepoint/dev/apis/webhooks/overview-sharepoint-webhooks

      Trevor SewardThanks for the reply and info. but each time I ask a question about remote event receivers and the problems we are recently getting, i got a link to use web hooks. but one main reason i do not and can not use web hooks is that they do not support Editing and Adding events, and they only support Added and Edited actions which only covers 70% of the cases i want to implement... so let go back to my question, how i can create a RER >> debug it >> attach it to existing lists..?

      Thanks in advance for your help.

Resources