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.
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”
- Add a parse activity to gather the data from the response (again use my previous blog on steps to build the parsing schema)
- 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
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!
Comments
Hi – this is exactly what I’m looking for and I was happy to find it. But I can’t get the whole “Fiddler” part to work. Fiddler is installed and I try to give it different kind of URLs, but I get all sorts of errors back, like “Error 400. The request is badly formed” and “403 FORBIDDEN”.
I have tried different things for the last half hour and have given up and will have to search on for another solution.
Hi Anders,
Are you sure that you have Fiddler connected to SPO properly? It isn’t very intuitive. A great blog on how to do this can be found here: https://cann0nf0dder.wordpress.com/2016/09/12/getting-fiddler-to-work-with-sharepoint-online/
Hi David,
Thank you for answering my comment and trying to help 🙂
I ended up, finding another solution to get the JSON object.I have tried to describe the process here:
https://powerusers.microsoft.com/t5/General-Flow-Discussion/Reading-Approval-Status/m-p/199210
In short, insted of using Fiddler to get the JSON object, I just used Flow to send it to me in an e-mail.
You just saved our bacon with this field….. OData__ModerationStatus … oh my goodness could they make it more complicated?? Double underscore?????
thanks a million
Happy it helped!