We will see these below things that are related to sharing SharePoint files/folders/items. This includes how to create a sharing link for a file or folder in SharePoint.
The files you store on a SharePoint site are usually available to everyone with permissions to the site, but you may want to share specific files or folders with people who don’t otherwise have access to the site. When you share files and folders, you can decide whether to let people edit or just view them. You can see who a SharePoint file is shared with, and stop sharing SharePoint files or folders, or change permissions, at any time.
If you want to send an email invitation to people, pick the file or folder you want to share by selecting its circle icon from SharePoint site.
Select share option, it will show following pop-up:

By clicking on small arrow next to the ‘People in your organization with the link can edit’ you can select an option for who you want to give access to with the link. It will show following options, please refer below screenshot.

Also, you can restrict access by selecting option ‘can edit’ or ‘can view’ as shown in below screenshot

Once you click on ‘Send’ option it will send email invitation like below

To open that shared folder or file, it will ask for verification code which will send to your same email account. It will look like as below screenshot.

If we want to automate sharing SharePoint files or folders, then here is the way.
SharePoint connector in Power Automate provides ‘Grant access to an item or a folder’ action to granting access to external users.

In the flow action, you can also include a message and choose to notify the recipients once they get access to the item or the file.
Note: if we set notify to recipients’ parameter to ‘No’ and recipients is external user, he will not get invitation link and not able to access SharePoint file or item without invitation.

To open folder or file, it is prompting for email verification and then for verification code to get access to that item as follows:

Using this approach, we can avoid anonymous link but need to perform extra verification steps.
Now, how can we skip that email verification part and experience only verification code step like through SharePoint out of box feature.
Most of the times organizations want to avoid anonymous share link because of the security reasons. Using this approach, we can avoid anonymous share link and create the share links for specific people using the email address.

@a1: 7B777e51e2-3abe-411d-9bce-eaeb3dca1b7c
@a2: 20
This is the Uri
_api/web/Lists(@a1)/GetItemById(@a2)/ShareLink?@a1=%27%7B777e51e2-3abe-411d-9bce-eaeb3dca1b7c%7D%27&@a2=%2720%27
This is the body request for non-guest email
{
"request": {
"createLink": true,
"settings": {
"linkKind":6,
"expiration": null,
"role":1,
"restrictShareMembership": true,
"updatePassword": false,
"password":""
},
"peoplePickerInput":"[{"Key":"xxx@email.com","DisplayText":"xxx@email.com","IsResolved":true,"Description":"xxx@email.com","EntityType":"","EntityData":{"SPUserID":"xxx@email.com","Email":"xxx@email.com","IsBlocked":"False","PrincipalType":"UNVALIDATED_EMAIL_ADDRESS","AccountName":"xxx@email.com","SIPAddress":"xxx@email.com","IsBlockedOnODB":"False"},"MultipleMatches":[],"ProviderName":"","ProviderDisplayName":""}]",
"emailData":{
"body":"",
"subject":""
}
}
}
Where,
“linkKind”:”6”, //6: specific,7: external “role”:”7”, // 2: can edit, 1: can view, 7: block download
“xxx@email.com”: this is email of external user.
When the recipients receive email, it will ask only for verification code (not for email verification followed by verification code), just like we receive email via SharePoint GUI.
By using grant access to file/folder or SharePoint REST API, we can automate the process of sharing link with specific external users using Power Automate flow. If you need help setting this up, contact us today.
I hope you found this blog helpful.
=====
Plus Read