Forum Discussion
Rohit404404
Sep 07, 2022Brass Contributor
Is there any way to generate Sharing Link without breaking inheritance on file
Hello
I had posted another question which i had posted here https://docs.microsoft.com/en-us/answers/questions/991989/create-sharing-link-using-csompnpframework.html?childToView=995490#comment-995490
We basically need unique link on document that does not change with a change in file location.
While we got answer partly, it led to another question which is, is there any way to get sharing link of a document in SPO without breaking its inheritance. Basically to generate sharing link with option of "Peopke with existing access" ?
Any way to have this by CSOM , Rest or Graph Api?
There are couple of options in CSOM , Rest and Graph ApI (beta) ..however they all have option of anonymous or organization sharing link whi h caused breaking inheritance.
We are going to gave large number of documents in library and unique permission will not help.
- kalpeshvaghelaSteel Contributor
If you are referring below option then even it will not generate unique link because here link will still have absolute path in link and it will break once document is moved somewhere else.
Below is the generated link using above option.
https://contoso.sharepoint.com/:f:/r/sites/Template/Shared%20Documents/TEST?csf=1&web=1&e=A5Va9J
Here I would suggest to go with Document ID feature. Below are some reference links to use it
Then your unique link would be https://contoso.sharepoint.com/sites/DocId1/_layouts/15/DocIdRedir.aspx?ID=DocumentID
Important: As per my knowledge above approach would only work when you move document withing same site collection but when you move document to another site collection link will be changed any way.
Hope it will helpful to you and if so then Please mark my response as Best Response & Like to help others in this community
- Rohit404404Brass ContributorThank you. however, dpcumentID generation is delayed by few mins .. hence we wont know when its available. So we are looking for sharing option