Using Microsoft Flow to know when a Modern Page is published

Reading Time: 3 minutes

For a business solution I was recently building using Microsoft Flow, I needed to know when a modern page had been published to automate additional processes after it. It turns out, this was not as straight-forward as I thought it would be. I decided to write this post to help others who find themselves needing to do the same thing.

How can you tell when a page is published? A published page can be identified by its version number. If it’s a major version (1.0, 2.0, 3.0, etc.), it’s published. If it’s not(1.2, 2.1, 4.1, etc.), it’s a minor version and therefore hasn’t been published.

Note: this is also true with the new Page approval workflow since that still operates under the major/minor version numbers at the page level.

Knowing this, we can check the version number in a Flow to determine whether or not a page has been published. Unfortunately, the version number (or the approval status) is not exposed in Microsoft Flow for a Site Pages library.

Here are the steps I took to get the version #:

  1. Build a flow triggered when a site page is modified.
  2. Retrieve the site page by its ID using the ‘Send an HTTP request to SharePoint’.
  3. Parse the version # from the JSON returned
  4. Check if the version # ends in ‘.0’ and if it does, it’s published!

Read on for details on each step.

Step 1: Trigger-based flow

Select the ‘When a file is created or modified (properties only)’ as the Flow trigger. Once you provide the sitename where your Site Pages library exists, you’ll notice the Site Pages library doesn’t show in the drop-down. That’s ok! Just provide the guid of the library instead.

To get the guid, browse to the Site Pages libary on the SharePoint site, go to Library settings and select the value after the List= parameter on the URL. Decode it.

Paste the guid into the Library Name and select the Site Pages folder (image):

SitePage guid

Step 2: Retrieve the site page

There is no version number property returned from the previous step to indicate if the page is published or not. To retrieve the version #, we need to get the Site page again using the REST API via the Send an HTTP request to SharePoint action with the ID from the previous step:

Send HTTP request to SharePoint

Step 3: Parse the Version # from the returned JSON

The JSON returned from the previous step contains the version number in the element OData__UIVersionString. In the Flow, create a string variable (VersionNumber in this example) to hold the version number and provide this expression for the value:


Initialize Variable

Step 4: Check if its a major version

It’s now a simple check to look at the version number to determine if its major (i.e. published).


If the above is true, its published. If it’s false, it’s draft! 🙂

What’s the use case?

If you have additional business processes you want to automate with your Flow after a type of page is published, this allows you to do that. I’m using this technique with multiple Site Page content types where I automate different actions depending on the type of Site Page published.

Thanks for reading.


One comment

  1. Now I understand why you asked 😉

    Less than a week between the question on twitter and the blog post on the solution.

    Thanks for sharing because, as Vesa wouldsay, «sharing is caring»

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.