Approve and publish SharePoint file using Power Automate

In this article, I will show you how to create a flow to approve files from a SharePoint Online document library. Power Automate is the cloud-based tool of M365 platform to create workflows. With on-premise versions of SharePoint, it could be possible to use flow using a data gateway on an hybrid environment.



Scenario

A user have created or uploaded a document in a library. He wants to make this document available to all site user. According to company policies, document must be reviewed and approved before publishing.

Set up document library

Go to your document library settings.

Then versioning setting


Set the versioning that matter to you.

In my opinion, you must set Draft item security at Only user who can edit at least. 


Configure your flow

In the ribbon, select Automate, Power Automate, Create a flow.


Chose see more templates option is order to have more choices.




Go to the left side menu click on Create.
Then select Instant cloud flow.


















Choose For selected file as trigger.




Once the flow is created, select the following actions:
  • Start and wait for approval
  • Condition Control
  • Get file properties
  • Get File Metadata
  • Set content approval status

In order to Set approval status, you need the Item Etag.


















Etag is retrieved using Get file metadata
File identifier is needed to Get file metadata so Get file properties is used before.
Nota: File identifier is not item Id.



Thing that can be done to improve your flow.

  • Check file status before starting approval, you cannot approve or reject a file that has been already approved or rejected.
  • In real business case scenario, you may need to message the one that trigger the flow when major action happen.
  • Change permission on file. It's still possible to interact on file status from SharePoint UI. So someone could by pass the flow. By changing file permission, you will be sure that on only approver set their approval through the flow process.



Comments

Popular posts from this blog

How to give app access on a specific SharePoint site using Azure AD API permission

Ensure SharePoint User with Power Automate

Guest user can't access Client Side Assets resources in SharePoint App Catalog site