Forum Discussion

Vidit_Gholam's avatar
Dec 09, 2022

Call Single Power Automate Flow for Multiple Document Libraries SharePoint

Hi Folks, 

 

I have a requirement where I need to send documents from different document libraries for approvals and then update the approval status back in the document library.

I am not able to figure out how to call a single flow for multiple document libraries. difficulty here is how will I figure out the flow has been triggered from which document library since I need to update the approval status of the document.

 

I am okay with any SharePoint script suggestions, or button customizations like calling the flow with an Http request on click of a button from the document library. I just don't know how to pass the document library details.

 

Thanks in advance.

3 Replies

  • Vidit_Gholam You might be able to find the item ID and list/library URL from triggerOutputs. Using that information, you will know from which library the flow is triggered.

     

    Also, check few workarounds given in my answer for similar flow requirements at: Can we create a single Power Automate flow which trigger when uploading documents inside 50 document libraries 


    Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

  • RobElliott's avatar
    RobElliott
    Silver Contributor

    Vidit_Gholam you would either have to trigger the flow manually or on a schedule. For example, the following flow runs at 7am each day. I've added a get past time action set to 1 day. Then add a get files (properties only) action for the first document library and set the filter query to Created ge 'the outputs of get past time' - make sure it's wrapped in apostrophes. Copy the action to your clipboard then click the + between the get past time and get files action and select add parallel branch and select the get files action from your clipboard and change the document library to the next. Add a parallel branch for each library you want to include in the flow.

     

    Under each brach you will need to add an apply to each, the start and wait for an approval action (again, you can save time by using the clipboard) and any other actions you want.

     

     

     

    Rob
    Los Gallardos
    Microsoft Power Automate Community Super User

    • Vidit_Gholam's avatar
      Vidit_Gholam
      MCT
      Hi Rob,

      Thank you for responding, the approach sounds great but unfortunately will not work for me as I need inputs from the users. But I have figured it out I triggered the flow by a button. I just wanted to know one thing is there a way to provision every new document library with the custom button I created or the permission I assigned to my library.

      Thanks,

Resources