Extracting EXIF metadata from SharePoint using Power Automate – Master Office 365

In this latest feature I have implemented in this awesome Power App I previously showcased in an earlier blog a few weeks ago, in this blog things get a little more exciting 😄.

Despite how awesome the previous version of the Power Apps & SharePoint – The Ultimate User Experience Power App I created for an earlier blog I published a few weeks ago, in this blog I have added a touch more genious to that app and things start get a really exciting 😄.

On the Microsoft Support web site, you’ll find some guidance insofar as how to Set up an Asset Library to store image, audio, or video files. Per this page, one of the features of an Asset Library states to quote:

Automatic metadata extraction for image files    When you upload image files to an Asset Library, any existing metadata for the file is extracted and promoted to any available corresponding columns in the library. Automatic metadata extraction is supported for the following image file types: BMP, GIF, ICO, JPEG, PNG, and TIFF.

Naturally Microsoft quite frequently like to change things like this, deprecated some functionality here and there, and then reimplementing that same functionality in some or other product that unsurprisingly infuriates many users, by example:

Bring back SharePoint Online Image Metadata Extraction

Microsoft’s own documentation still says that this function is available for Asset Library’s, but Microsoft Support says the feature is deprecated (without notice to users).

User Comment

That isn’t so cool. Microsoft deprecated that specific out-the-box functionality, so where did they thus move it to? Seemingly to Azure Cognitive Services Computer Vision.

Azure’s Computer Vision does a whole lot of other stuff such as analyzing images to detect and provide insights about their visual features and characteristics provide by the Analyze Image API. As such, this blog certainly can’t possibly speak to all the functionality and content surfaced by the Cognitive Services Computer Vision API,.

If in fact it actually even possible to actually do something quite similar using the Computer Vision API, seemingly Simon Hudson figured out how to accomplish it earlier this year. Even then Simon gave very well deserved credit to John Liu.

Well done guys, because between those 2 blogs I don’t even think I could have come close to figuring out some of the really fantastic code , and that’s coming from a MCSM Charter SharePoint 👏 . Check out Simon and John’s own blogs on this topic because they have set the benchmark wrt this particular topic 🤗:

Either way, it certainly “used” to be possible to extract EXIF metadata information such as GPS coordinates as well as the date a photo was taken etc. In fact, according to Microsoft’s own support website, it still is:

Seemingly at least up until 8 December 2019 EXIF metadata was in fact still being extracted from content uploaded to SharePoint. This metadata can still be surfaced using the RenderListDataAsStream API for content uploaded to SharePoint prior to 8 December 2019.

Accordingly the technique described in this blog at least may well only be of relevance should you wish to expose the EXIF metadata for historical data but this blog at least should hopefully be useful for many people caught off guard when Microsoft deprecated this functionality automatically within SharePoint Online.

The type of throughput I have been able to successfully test with flow I am sharing in this blog in concerned, in order to extract EXIF metadata data properties including the Longitude, Latitude, Altitude, Address, Basic Tags (outdoor / indoor / person), ThumbnailUrl, Camera Make, Model, blah, blah, blah all within a single flow containing less than 20 steps in total, 10 of which are simply initializing and setting variables, with paging comes to a whooping 45 seconds on averages per 5000 photos processed from a Site Assets Library containing over R10k of photos, about 25% of which are photos between 4MB and 20MB.

Power Apps & SharePoint Demos with EXIF Image Metadata Extraction

Power Apps & SharePoint Demo with EXIF Image Metadata Extraction
Power Apps & SharePoint Awesome Demo Photos GPS Geolocation

PA_RenderListDataAsStream_GeoLocation Power Automate Flow

As I alluded to earlier in this blog, all the EXIF metadata surfaced in the demo app has been made possible using by all accounts a simple Power Automate flow. In fact actually extracts significantly more EXIF metadata then I’ve showcased in the demo app showcased in this blog.

As I am in any case sharing a link to download the flow as is described in this blog, and equally in the interests of “my” own time currently, I am primarily going to focus on the particular steps in the flow that are of most significance.

Overview

Did I mention the flow was relatively simple, I forget 🤗.

In order instantiate this flow from PowerApps, you’ll need to pass 4 input parameter to the flow, those being:

Parameter NamePurposeExamples
triggerBody()[‘SendanHTTPrequesttoSharePoint_SiteAddress’]URL to Site or Subsite https://tenant.sharepoint.com/teams/multimedia
https://tenant.sharepoint.com/teams/multimedia/masteroffice365
triggerBody()[‘SendanHTTPrequesttoSharePoint-RenderListDataAsStream_Uri’]Relative path to Document Library and subfolders if desired/teams/multimedia/masteroffice365/Videos
/teams/multimedia/masteroffice365/SiteAssets
/teams/multimedia/Shared Documents
/teams/multimedia/Personal Memories/GEO Mapped Photos
triggerBody()[‘SendanHTTPrequesttoSharePoint-RenderListDataAsStream_Uri_1’]Document Library NameVideos
Site Assets
Documents
Personal Memories
triggerBody()[‘NextHref_Value’]For paging . will explain later!false

Do Until Loop

The Do Until loop per the Power Automate flow shared in this blog will only run through each step once, and not actually loop through each page of results returned by the Send an HTTP request to SharePoint – RenderListDataAsStream step in the flow. The reason being is that the Send an HTTP request to SharePoint – RenderListDataAsStream step in the flow will return as many as 5000 rows from the Document Library being queried.

Based upon the testing I have done querying a Site Assets Library containing 10k photos, to query the RenderListDataAsStream API specifying a page size of 5000 rows typically takes approximately 45 seconds to complete.

When attempting to retrieve the 2nd page of 5000 rows in the same flow run, the average time the flow run typically takes to complete increases to approximately 2 minutes. From a Power Apps web browser session, the maximum timeout Power Apps will wait for the result set returned by a flow run is seemingly 120 seconds. Accordingly if the flow is configured to, for example, return up to 10k in any given flow run, approximately 50% of the time the Power Apps session will time out.

Accordingly for the Power Automate flow shared, the Do Until loop is hard-coded to in effect only loop through the steps in this action once.

The reason for nonetheless incorporating a Do Until loop in the flow shared is such that should your requirements alternatively be to, for example, run the flow on a scheduled basis and not directly from a Power App, with minor modifications to the flow you could alternatively configure the flow to loop through the entire contents of any given Document Library in a single flow run, even if that Document Library contained, for example, 100k of photos, if not more.

Send an HTTP request to SharePoint – RenderListDataAsStream

PropertyExpressionExamples
Site AddresstriggerBody()[‘SendanHTTPrequesttoSharePoint_SiteAddress’]https://tenant.sharepoint.com/teams/multimedia
https://tenant.sharepoint.com/teams/multimedia/masteroffice365
Uri_api/web/lists/GetbyTitle(‘triggerBody()[‘SendanHTTPrequesttoSharePoint-RenderListDataAsStream_Uri_1′]’)/RenderListDataAsStream±_api/web/lists/GetbyTitle(‘Videos’)/RenderListDataAsStream
_api/web/lists/GetbyTitle(‘Site Assets’)/RenderListDataAsStream
_api/web/lists/GetbyTitle(‘Documents’)/RenderListDataAsStream
HeadersKey: Accept
Value: application/json
Key: Accept
Value: application/json
Body_api/web/lists/GetbyTitle(‘triggerBody()[‘SendanHTTPrequesttoSharePoint-RenderListDataAsStream_Uri_1′]’)/RenderListDataAsStream {
    “parameters”: {
        “RenderOptions”: 4103,
        “ViewXml”: “<View Scope=\”RecursiveAll\”>
            <ViewFields>
                    <FieldRef Name=’ID’ />
                    <FieldRef Name=’FileLeafRef’ />
                    <FieldRef Name=’FileDirRef’ />
                    <FieldRef Name=’FileRef’ />
                    <FieldRef Name=’FileLeafRef.Name’ />
                    <FieldRef Name=’FileLeafRef.Suffix’ />
                    <FieldRef Name=’File_x0020_Type’ />
                    <FieldRef Name=’MetaInfo’ />
                    <FieldRef Name=’MetaInfo.’ />
                    <FieldRef Name=’MediaServiceMetadata’ />
                    <FieldRef Name=’MediaServiceFastMetadata’ />
                    <FieldRef Name=’MediaServiceDateTaken’ />
                    <FieldRef Name=’MediaServiceAutoTags’ />
                    <FieldRef Name=’MediaServiceLocation’ />
                    <FieldRef Name=’MediaServiceOCR’ />
                    <FieldRef Name=’ParentUniqueId’ />
            </ViewFields>
            <RowLimit Paged=\”TRUE\”>5000</RowLimit>
        </View>”
    }
}

The Send an HTTP request to SharePoint – RenderListDataAsStream step in the flow queries the RenderListDataAsStream API which in turn returns a result set of up to 5000 rows containing a collection of files in the Document Library being queried, exposing the EXIF metadata for various file types such as photos and videos files.

The EXIF metadata fields of particular interest for this blog include:

<FieldRef Name='MetaInfo.' />
<FieldRef Name='MetaInfo' />
<FieldRef Name='MediaServiceMetadata' />
<FieldRef Name='MediaServiceFastMetadata' />
<FieldRef Name='MediaServiceDateTaken' />
<FieldRef Name='MediaServiceAutoTags' />
<FieldRef Name='MediaServiceLocation' />

Now what?

This blog is too awesome not to share now. I will accordingly update it frequently explaining what each of the steps do.

All you need to do is import the Power Automate flow I shared the link to in the next section of this blog, for now at least.

Download the Power Automate flow

Download the Power Apps & SharePoint Demo with EXIF Image Metadata Extraction Power Automate Flow template.

PA_RenderListDataAsStream_GeoLocation v3.zip

Happy app making!

By all means contact me or any of your own requirements.

Leave a Reply

Your email address will not be published. Required fields are marked *

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