Sunday, 27 May 2018

How MS Flow displays SharePoint Online Taxonomy field values

If you have Office 365 tenant and didn't play around with MS flow, I believe you're missing out on something big here. You can use Microsoft flow to basically do everything, yes I said it "everything" I might be exaggerating but I know a friend who basically almost doing everything using MS Flow. If you are in doubt just follow @johnnliu  on twitter and see for yourselves.

And it's free, yes for only 2000 runs per month but for a productivity tool , who want more than that :) and  If you are looking to do some integration work, I suggest you go for Azure Logic apps , which is the underlying platform of Microsoft Flow. if you want to abuse Microsoft flow you can add more runs as cheap as 8 cents per additional 100 runs.

let's dive through the topic of this blog, in order to help you review everything in action, we will start by creating a new flow, for simplicity we will use HTTP trigger so we can trigger the flow using simple GET request.

The action we will be performing here is to update SharePoint file properties, to make this work you will have to connect to existing SharePoint online library that has been enriched with a taxonomy field as an attribute of a custom content type driven from the parent "Document" content type.

The main question I had here is how flow is retrieving the classification values because I wanted to select the value based on a specific parameter and I want to piggyback on what MS flow already knows.
If you trace the XHR requests in the browser developer console, you will be able to find mulitple request to specific endpoint similar to the following URL:

This request will allow MS flow to load all the selected document library properties and that include all the lookup, taxonomy fields and many other properties

One particular property is the URL to the taxonomy field values which is the same url with /entities/{some_guid} added to it as a suffix.

If we trace the request we will be able to extract the Authorization Bearer header which contains typical JWT token properties including:
Issuing Authority
AppId                         6204c1d1-4712-4c46-a7d9-3ed63d992682

If we navigate to Azure portal and search for this app in the enterprise apps under Azure AD we will find Microsoft Flow Portal app which strangely enough have no permissions visible through azure portal.

And that's how Microsoft flow display your SharePoint taxonomy fields values within SharePoint update file properties action.

Related Articles