Forum Discussion

KjoniX's avatar
KjoniX
Copper Contributor
Jun 10, 2024

One approval flow across multiple Sharepoint Sites

I have a site structure / document libraries as follow:

 

https://mysite.sharepoint.com/sites/project1/projectdocuments

https://mysite.sharepoint.com/sites/project2/projectdocuments

https://mysite.sharepoint.com/sites/project3/projectdocuments

https://mysite.sharepoint.com/sites/projectN/projectdocuments

 

How can I have one approval flow for all libraries?

I have seen several blogs on this subject, but all are 4-5 years old. Any news here?

 

 

 

 

3 Replies

  • Yanuanda's avatar
    Yanuanda
    Copper Contributor

    To create a single approval flow that works across multiple SharePoint document libraries in different site collections, you can leverage Microsoft Power Automate (formerly known as Microsoft Flow). Power Automate allows you to create workflows that can interact with various SharePoint sites and libraries, providing a unified approval process.

    Here’s a step-by-step guide to setting up an approval flow for multiple document libraries using Power Automate:

    Step 1: Create a Power Automate Flow

    1. Go to Power Automate:
    - Navigate to [Power Automate](https://flow.microsoft.com/).

    2. Create a New Flow:
    - Select "Create" from the left-hand menu.
    - Choose "Automated flow".

    3. Configure the Trigger:
    - For the trigger, use "When a file is created or modified (properties only)".
    - Since you have multiple document libraries, you’ll need to add this trigger for each library:
    - `https://mysite.sharepoint.com/sites/project1/projectdocuments`
    - `https://mysite.sharepoint.com/sites/project2/projectdocuments`
    - `https://mysite.sharepoint.com/sites/project3/projectdocuments`
    - `https://mysite.sharepoint.com/sites/projectN/projectdocuments`

    Step 2: Add Multiple Triggers

    1. Add Multiple SharePoint Triggers:
    - In the flow, add a new step and select "When a file is created or modified (properties only)" for each document library.
    - Configure each trigger to point to one of your document libraries.

    Step 3: Initialize Variables

    1. Initialize a Variable for Document URL:
    - Add a new step to initialize a variable to store the document URL.
    - Initialize it as a string variable.

    Step 4: Configure Conditions and Actions

    1. Use a Condition to Check Which Library Triggered the Flow:
    - Add a condition to check the path of the document library where the file was created or modified.
    - You can use conditions like:
    ```plaintext
    If "ProjectDocuments URL" contains "project1", "project2", etc.
    ```

    2. Send an Approval Request:
    - Add the "Start and wait for an approval" action.
    - Configure the approval request with the necessary details (approvers, message, link to the document).

    3. Configure Approval Outcome:
    - Add steps to handle the approval response:
    - If approved, move the document to another folder, notify the uploader, etc.
    - If rejected, notify the uploader with the reason.

    Step 5: Test and Refine the Flow

    1. Test the Flow:
    - Upload or modify files in the different document libraries to ensure the flow triggers correctly and the approval process works as expected.

    2. Refine the Flow:
    - Adjust any settings or conditions as necessary to ensure the flow behaves correctly for all scenarios.

    Example of Flow Components

    - Trigger: When a file is created or modified (properties only) for each document library.
    - Condition: Check if the document URL contains "project1", "project2", etc.
    - Approval Action: Start and wait for an approval.
    - Response Handling: Conditions for approved or rejected outcomes.

    Summary

    By using Power Automate, you can create a centralized approval workflow that works across multiple SharePoint document libraries. This modern approach allows for more flexibility and integration compared to older methods. Ensure to keep your flow organized, document each step, and regularly test and update the flow to maintain its functionality and efficiency.

  • Hello,

    It is not possible to have a single approval flow for all the documents (but you can make it feel like it).

    You would need to create a Power Automate for each document library. Each flow should take necessary document metadata and put it in a SharePoint list. That SharePoint list should then have a trigger to send item for approval. If approved, you will have metadata to target the right item in the right document library. Finally, approving it.
    • KjoniX's avatar
      KjoniX
      Copper Contributor
      Thanks, but not sure about that.
      I think it is possible to subscribe to webhooks for all websites and use this subscription to trigger det approval, but I hoped it was easier solution in 2024...

Resources