
Sharing links in Onedrive/Teams/Sharepoint can be of the View, Edit, Review or No Download type.
There is no official Graph API or PnP module call that can be done to modify a link, it has to be done manually in the GUI as per Microsoft.
That didn’t work for me, as I’m working on some migration scenario’s where all links have to keep working, but should not allow users to edit or download the files.
So I did some digging, turns out there is a ShareLink GetSharingInformation endpoint that can be called for any object.
And with good ‘ol Claude, a script was built and tested in half an hour that iterates over a given sharepoint site(s) or a specific file and adjusts the link. I’ve made it configurable and use certificate based auth, enjoy!
https://github.com/jflieben/assortedFunctionsV2/blob/main/Update-SharingLinks.ps1



