When the business wants to control the data that is displayed to users a great way to do this is with content approval.  It’s easy to implement and use.  Simply enable the option in version control and anyone with Full Control, Design or Approve role is able to approve the items.

Determine Approval Status of SharePoint List or Library Item - Enable Content Approval

There is a great write-up by Chakkaradeep Chandran on how to automate the approval process of these items.  However, what Microsft Flow is missing is the ability to see what status the approval process is at.  There are many requests for this information in the Flow forums with no solutions beyond statements that Flow is lacking in this ability.  I was able to come up with a working solution to achieve this.  So read on to learn how to determine the approval status of a SharePoint list or library item.

Determine The Approval Status of a SharePoint List or Library Item

To accomplish this you will need to review two of my previous post on parsing JSON in Microsoft Flow.  The reason being is you are doing this with an HTTP call to a SharePoint REST endpoint.  When you enable content approval it adds a new column to the list\library called Approval Status.  While poking around to the columns returned in an item call I noticed an internal column called OData__ModerationStatus.  This looked conspicuously like a column that I needed.  Further investigation indicated I am likely correct.  This means then that while Microsoft Flow will not accomplish what we want, a REST call certainly will.  In fact, just getting the item will return the value, but we are going to refine that down so we don’t have to dig too far into response body to get the information we need.

The steps to determine the status are as follows:

  • Add a SharePoint HTTP call that accesses the endpoint “_api/web/lists/GetByTitle(‘Pages’)/items(<ID>)?$select=OData__ModerationStatus”

Determine The Approval Status of a SharePoint List or Library Item - SharePoint HTTP Call

Determine The Approval Status of a SharePoint List or Library Item - Parse Approval Status Response

  • Finally you can work with the result of the HTTP call.  In my case I used it in a condition.  Remember the values:
    • 0: Approved
    • 1: Rejected
    • 2: Pending approval\rejection
    • 3: Draft
    • 4: Scheduled for automatic approval

Determine The Approval Status of a SharePoint List or Library Item - Check Value of Response

And that’s all there is to it.  Until Flow allows you to check it as a built-in feature of the service, this solution should work just fine.

 

Thanks for reading!