Saturday 20 July 2019

Create and Share Scoped Links of SharePoint Files to Users using Microsoft Flow

Assume a file is getting generated/getting created by users on the SharePoint online platforms. The business wants to share the file links with the targeted groups/users, which is view-able or editable. This business process is automated using SharePoint’s in-built sharing feature and Microsoft Flow.

SharePoint online has an inbuilt share feature, for creating links for items/files on it’s platform (At the end of this article, this OOB share feature snapshot is shown for reference). The scope of this feature is available in the following levels.
  • Anonymous
  • Organization
  • Specific people

Microsoft Flow has a SharePoint action called “create sharing link feature for a file or folder”. At the time of writing, this action has the following scopes only.
  • Anonymous
  • Organization
Note: 
  • The type of access could be either 
    • view and edit
    • or, view
  • There is no scope for sharing it to specific people.


Build/Configure Flow To Share Links


Let us now look at building the flow, for sharing the link with anonymous scope. In this case, the link with anonymous scope permission is generated.
  • Identify the site and library where the flow will be configured.
  • From Microsoft Flow portal, under my flows, create a flow from blank.
  • The trigger to be created
    • when a file is created in a folder
  • The actions to be configured
    • Get file metadata using path – Use the file path from the trigger
    • Create sharing link for a file or folder – Get item id from the previous action
    • Send an email – Configure Sharing link field from the previous action into the subject/body. Update “To address” with some user email address.

Note:
  • For sharing the link to multiple users/groups, the send an email recipient address needs to be updated.
  • If you want to use other channels for sharing the links, then the same can be configured as part of this flow. For example, yammer/twitter/facebook actions could be used to share the link to mass audience, based on business requirement.
The following snapshot shows the actions configured on the flow for sharing link to a user.  (Trigger is not shown in the snapshot, and that is left to your scenarios).
Flow for sharing SharePoint links (scoped) over mail
Flow for sharing SharePoint links (scoped) over mail


SharePoint Default View (Just for reference)


The following snapshot shows the OOB view of sharing feature available.
SharePoint OOB - Share Option
SharePoint OOB - Share Option