How to deploy a flow across all document libraries in SharePoint

In this post we look at a specific use case for needing a Power Automate flow to be available across all of SharePoint, some of the current limitations of Power Automate and how to overcome them using Encodian Trigr.

Intro

Most organisations will have a central location where they store policies, procedures and guidance documents. For most, this would form part of their corporate intranet solution on SharePoint/ Teams, but you also might find yourself getting asked by users “how do I get my policies from my team/ collaborative locations into the the corporate policy library?” – not such an easy answer!

The problem

Policies generally can be created by individuals and small groups of people, within the Teams/ SharePoint sites that they have access to for collaboration. For these people, having a way to publish relevant documents from their own collaboration sites to a central policy location in a consistent way makes a great deal of sense and you may think Power Automate is the way to achieve it…however this is not the case! Power Automate flows have a 1:1 relationship with the lists or libraries they are triggered from, so there is no easy way to do this with out-the-box capabilities.

Power Automate is also unable to manually trigger a flow when selecting multiple documents, something else that my scenario requires. This is where Encodian Trigr can really bridge the gap. Trigr makes Power Automate flows available across SharePoint, allowing users to access and run flows from within any library or list.

The solution

In my example, I needed to have a flow available across all SharePoint/ Team sites, which would allow all users to select one-to-many documents and publish to a central policy upload center for approval – and here is how I used Encodian Trigr to achieve it:

Install Trigr

  • There is a comprehensive guide on how to deploy the Encodian Trigr app available here. I followed these steps to get Trigr setup in my environment.

Create the flow

  • Navigate to https://make.powerautomate.com/
  • Under My flows > + New flow > Automated cloud flow
  • Give your flow a name
  • Search and select the Encodian ‘When a user runs a Trigr‘ Power Automate trigger action
  • Click create
Create an automated cloud flow and select the ‘When a user runs a Trigr’ Power Automate trigger action.

NOTE: This was my first time using Encodian Trigr, so I was prompted to provide a connection name and an API key. For the connection name I just entered ‘Encodian connection for flow’, and the API key will be in your welcome email, or available via this link: https://account.encodian.com/trigr/apikey.

  • You will now see the ‘When a user runs a Trigr‘ trigger action. Enter a title & description for your flow
Add a title and description to your ‘When a user runs a Trigr’ trigger action.

The ‘When a user runs a Trigr’ Power Automate trigger action provides all of the properties relevant to the files which were selected by the user when the Trigr action was started.

For the next step we are going to use the get file content action. Due to a current limitation of Power Automate, dynamic values are not immediately accessible by the SharePoint action. To get around this, we will just enter hard-coded values at first, then replace them with dynamic values once we have finished configuring the flow.

Get file content

  • Add a get file content action
  • Hard-code the site address of the site where the files are saved that you wish to publish
  • Hard-code the file identifier as just the ID number for now

Send an email

  • Add a send an email action with the the following confirguration:
    • To: User Email Address dynamic content from the ‘when a user runs a Trigr’ trigger action’
    • Subject: Anything you wish
    • Body: Anything you wish
Add a send an email action if required to notify the user who triggered the flow they have submitted a policy document.

Update get file content

Now we will go back to our get file content action and update the hard-coded values with dynamic content from the ‘when a user runs a Trigr’ trigger action’:

  • Open the get file content action
  • Update Site Address to Site Address dynamic content from the ‘when a user runs a Trigr’ trigger action’
  • Update File Identifier to File Identifiers

NOTE: This will create put all your actions in an apply to each loop, which is what we want if we want to be able to process multiple documents. The File Identifier dynamic content will be replaced with the current item from the apply to each loop.

Update the get file content action to include the current item from the apply to each loop.

Copy file

  • Add a copy file action after the update get file content action and configure with the following properties:
    • Current site address: site address dynamic content from the ‘when a user runs a Trigr’ trigger action
    • File to copy: Current item apply to each dynamic content
    • Destination site address: select/ hard-code the destination site address (in my case the policy site)
    • Destination folder: select/ hard-code the destination library/ folder
    • If another file is already there: replace
Add a copy file action to copy the files the flow has been ran against into the policy center.

Create the Trigr action

So far we have installed trigr in our environment, created the flow which will be used and now we need to create the Trigr action in the Encodian account portal:

  • Select the flow that you created earlier and configure with the following settings:
    • Title: This will auto-populate from the data set within the Power Automate Flow, update if required.
    • Description: This will auto-populate from the data set within the Power Automate Flow, update if required.
    • Run Message: Enter a message which will be displayed to the user once the action has been started.
    • Appear in: Tick whether you want your flow to appear in all libraries/ lists or both. You can also decide whether you wish to deploy the flow to all sites or a selection.
    • Press Create

That’s it! Your Trigr action will now be created and your flow will be available across your SharePoint environment.


Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s