Forum Discussion

mgongAPI's avatar
mgongAPI
Copper Contributor
Mar 03, 2025

Webhooks for file permissions changes

Hey there! 

 

I am looking to receive a webhook from Sharepoint when permissions on a file or folder change. This doesn't seem like an explicit event in Sharepoint, but I did find this https://learn.microsoft.com/en-us/onedrive/developer/rest-api/concepts/scan-guidance?view=odsp-graph-online#receiving-webhook-notifications-for-security-events: 

 

I've tested using this header a few times, but so far have not been able to receive the webhooks. Here is a cURL of my webhook setup request: 

curl --location 'https://graph.microsoft.com/v1.0/subscriptions' \ --header 'Authorization: Bearer [redacted]' \ --header 'Content-Type: application/json' \ --header 'prefer: includesecuritywebhooks' \ --data '{ "resource": "/drives/[drive_id]/root", "changeType": "updated", "notificationUrl": "[target_url\]", "expirationDateTime": "2025-03-03T21:15:14Z", }'

 

Sharepoint responds with a 201, with the following response headers:

 

"headers": { "User-Agent": "Mozilla/5.0", "Accept-Encoding": "gzip, deflate, br", "Accept": "*/*", "Connection": "keep-alive", "Authorization": "[redacted]", "content-type": "application/json", "prefer": "includesecuritywebhooks", "Content-Length": "405" }

 

So it does seem that the header was accepted. In terms of licenses, my Sharepoint instance is tied to a user with an E5 trial license, and a paid E3 license. I am still not receiving webhooks when permissions update on files. I do receive other webhooks (ie files changed, added etc), just not for a permission change event. 


Has anyone figured out how to use this header successfully? 

 

Thanks! 

1 Reply

  • LingaReddy's avatar
    LingaReddy
    Occasional Reader

    Hi ,
    Did you get solution for the above problem ?

    i do have a similar problem , please let me know if you find the working solution to get the notifications for permission changes.

    Thank you

Resources