-1

Is there an easy way to trigger a webhook from a sharepoint online list?

My scenario is, I need a way to all end users to power on azure VMs. I have a list of VMs and their resource groups in a sharepoint list. I also have a runbook that can power on a VM, and just needs the vmname and resource group as parameter. So what I need is a way for endusers to trigger the runbook and pass the vmname and resource group.

Any ideas?

0

Following steps need to be done for configuring the web hooks,

  1. Create the subscription for the particular list.

    a. Call the rest api https://YourDomain.sharepoint.com/sites/yoursite/_api/web/lists('list-id')/subscriptions

    b. Pass the following header and data.

    Accept: application/json
    Content-Type: application/json
    
    {
     "resource": "https://contoso.sharepoint.com/_api/web/lists('5C77031A-
      9621-4DFC-BB5D-57803A94E91D')",          
    
    "notificationUrl":"https://91e383a5.ngrok.io/api/webhook/handlerequest",
    "expirationDateTime": "2016-04-27T16:17:57+00:00"
    }
    

    "notificationUrl" given in the above is the API that gets called when event occurs.

  2. Inside your API, make a call to /GetChanges API to get the changes.

Further read:

  1. https://dev.office.com/sharepoint/docs/apis/webhooks/lists/create-subscription
  2. https://msdn.microsoft.com/en-us/library/office/dn531433.aspx#bk_ListGetChanges

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.