Flow Approvals with SharePoint Document Publishing

UPDATE: Since writing this blog, Microsoft have rebranded Flow as PowerAutomate.

Creating a Flow from a SharePoint Online document library reveals a template “request managers approval for selected file” Flow. Once configured, a Flow becomes available form the Flow menu that send starts and approval process, however it is missing one key feature. It doesn’t actually approve a draft item and publish it.

SharePoint document libraries have a feature for authoring draft documents and then publishing. Draft versions of document are only visible to the editor(s) and approvers, while users with read access only see the last published major version. For example, version 1.0 is a major version visible to all users, updating the file creates version 1.1, 1.2 etc that are visible to the editors only, once published the most recent minor version becomes version 2.0 and is visible to read only users.

Document publishing is a great feature for controlled documents, contract management systems, policies etc. It is a core feature of all supported versions of SharePoint.

This video shows how to modify the out of the box Flow adding SharePoint document publishing.

Things to be aware of:

  • Users must have edit rights to the file to run the Flow
  • This example doesn’t check the status of the item and only works if the document is draft. You could add a condition to check for this if needed.

Any one who will act as an ‘Approver’ will need to approve the item. The SharePoint permissions ‘Design’ and ‘Full Control’ give this level of access or ‘Owner’ if you are using Office 365 Groups. A user who is an Office Group Member (Edit permission) cannot approve an item but can submit an approval.

This Flow could be extended further to generate PDF versions of a Word document or copy the approved file to a different location.

Don’t forget to Share the Flow with users who can request approval!

You may also be interested in this blog I wrote on getting signatures with SharePoint and Word.

Please subscribe to my YouTube channel for more demos.

16 comments

  1. Good post, I love it so much.I was pretty lucky to discover your site. There’s a lot of useful information!

  2. Thanks so much for this. This has really helped me as I’m new to Flow and learning as I go.
    Can you explain how you’d do this with an Automated flow please, e.g. using the SharePoint When a file is created or modified (properties only) trigger?

    • Hi Nicola,

      You cannot trigger just on a property changes unfortunately. I’d like that option!

      the best way is to start a new flow using the SharePoint trigger. In Power Automate, choose ‘Create’ and then follow these steps:
      – Choose Automated Flow
      – Select the ‘When an File is created or modified’ (there is an Item option if you want to do this for list items)
      – This will create the basic Flow template, then add the approval steps. The easiest way is to copy the steps from the ‘Send file to Manager for Approval’ Flow
      – Add some logic to check the value against another column e.g. store current and previous values of the field you want to check has changed.

      I hope this helps 🙂

  3. Hi Steve,

    I cannot get this to work.

    The trigger that most matches your suggestion is ‘When a file is created or modified in a folder’.

    Unfortunately I can’t add a screenshot to show you but I have the following:

    Automated Flow

    Trigger: When a file is created or modified in a folder

    Get file metadata

    Get file properties

    Condition: File path is not equal to 404

    If yes: If no:Terminate

    Start and wait for an approval

    Set content approval status to Pending

    Condition: Response is equal to Approve

    If yes: If no:

    Set content approval status to Approved Set content approval status to Rejected

    Send an approval email notification Send a rejection email notification

    Can you please advise?

    Thank you.

    Nicola

  4. Hi. How do you get Modified By to show the name of the Approver instead of the name of the Requestor who generated the flow?
    How do you add a condition to check for Draft status, as you mentioned in your comments? My people keep submitting the flow in Pending instead of in Draft and it’s impossible for them to remember not to, apparently.

    • Hi Antoinette,

      Modified By is a system value for the last person to change the document or it’s metadata. Creating a person field for the Approver value is the best way to capture the actual approver.

      If you minor versions and approvals enabled on the library, the built in approval statuses are Draft, Pending and Approved. In Power Automate once you have set an Approval status, you can get the current value “ContentApprovalStatus” to check the value.

      I hope this helps

  5. Hi Steve
    I noticed in your video and in my testing that the approval status never changes to “pending” after submitting the flow. The status does successfully change to accepted/rejected when the approver responds, but I expected it to change to pending before this because of the flow step where we set the approval status action to pending.

    Is there a fix for this?

    Thanks for your help.
    Andrew.

    • Hi Andrew, you are right the video doesn’t show the change to Pending. The solution is to set the status earlier in the Flow before sending the approval. SharePoint does change the status but it doesn’t show it in the demo. Hope that helps.

      • Hi Steve
        thanks for responding.
        I thought that the step which sets content approval status with an action of “submit” was intended to change the status to pending? In my flow my submit step runs directly after the “start an approval” step so I can’t set the status any earlier than this. I notice you do the same thing.
        Am I missing something?

        Thanks
        Andrew

      • Hi Andrew, in the ‘Set Approval Status’ action do you have the ETag? You need to have a ‘Get File Metadata’ action before setting the approval to get the ETag.

      • Hi Steve
        yes I already have that.

        Get File Metadata–>Start approval—>Set Content Approval Status to Submit (with Etag) –> Condition to check response —>……

        Everything is working apart from the interim setting the status to pending.

      • Hi Steve
        I wanted to update you on this as I got it working. The solution is to set the content approval status to pending using an action of submit before the approval process starts. I think you may have said this earlier in your responses, but I guess I missed it as it seemed counter-intuitive and in fact you don’t show this in your video. In your video you set content approval status to submit *after* start an approval. It has to be before otherwise the status never shows as pending.

        Anyway I appreciate you taking the time to create this blog and respond to me. Considering this approvals process is the replacement for SP2010 Approvals its odd its not documented in more places.

        All the best
        Andrew.

      • Hi Andrew,
        thank you for posting the solution to the issue. That makes sense!
        The reason I made the video was because of the gap in documentation. It was something I was doing on a project at the time.
        Glad it helped and thanks feedback too.
        Cheers
        Steve

Leave a comment