Currently in the Microsoft Flow 'Create sharing link for a file or folder' the Link Scope field only has the following options:
- Anyone with the link, including anonymous
- People in your organization
Please also add the following option which is available in SharePoint and OneDrive:
- Specific people
We really need to be able to create a sharing link just for specific people.
This depends on the availability of the API in Onedrive and SharePoint.
At the moment, the scope of link to create either anonymous or organization.
The following values are allowed for the scope parameter. If the scope parameter is not specified, the default link type for the organization is created.
Anyone with the link has access, without needing to sign in. This may include people outside of your organization. Anonymous link support may be disabled by an administrator.
Anyone signed into your organization (tenant) can use the link to get access. Only available in OneDrive for Business and SharePoint.
However, with David, you can do the seem-imposible-thing :))) 😀
You can use the "Send a HTTP request to Sharepoint" to get a Shareable link to a specified external user
This is the URi
This is the body request for non guest email
To parse the output, use Parse Json action
Generate Schema from the Output of Send HTTP request
This is sample output
Control who can use default "Share" button to share the file with Site sharing settings: Go to a Site => (gear) Settings button on top-right => Site Permissions => Change how member can share
You should consider some security reasons before sharing a link:
Enjoy your works with Microsoft Power Automate!
Thanks - that looks pretty awesome! Just one question - if you want the link to expire automatically 7 days after being generated, do you have to amend the "expiration":null, field? If so, what would the syntax be?
You can pass the Universal datetime format: yyyy-MM-ddTHH:mm:ss.fffZ
In my flow, I ask the user who triggers the flow to type the number of days for sharing the file, then I add it to the response date from the approval action.
About the LinkKind and other settings, review this article:
The body request you need to make sure your changes will not break the Json format. If not, there will be the error message like not well-formed Json format.
Thanks again - will give this a try
Thanks - I've made good progress with this project now. I made a couple of changes - set linkKind to 6 (not sure what 7 does - the documentation doesn't mention that option) and role to 1 (View only), which appear to be working.
The only bit where I'm stuck is the expiration date. If I leave it as null, the HTTP request completes fine. But when I try to set a date as per the example, I get this error message:
"message": "String was not recognized as a valid DateTime.
The expression I'm using is this:
Which does appear to generate the correct output when running the flow:
Any ideas on what type of date format it is looking for?
You should review what I commented:
only fffZ (3 numbers) is accepted.
Thanks again @David_Nguyen
The devil was in the detail! It now "works", using this bit of code for setting the expiration date:
I say it works - the flow runs successfully, but totally ignores the expiration date. I assume this is because the sharing link is not an Anonymous link.
Therefore I've added a few more steps which delete the folder and its contents after 7 days, effectively breaking the sharing link and rendering it useless.
I tested once and when I opened the link after the expiration date, it shown nothing.
You can test again with time in the next 5 minutes, then access the link again (if I am not wrong :))) )
Let me know the result.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.