In this latest feature I have implemented in this awesome PowerApp I previously showcased in an earlier blog 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:
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 API 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 most certainly does not speaks 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 🤗:
- Simon: Auto-Classify Images in SharePoint Online Library – an epic Real-World Flow
- John: Auto-Classify Images in SharePoint Online library via Flow for Free
Either way, it certainly “used” to be possible to extract EXIF metadata information such as Location data as well as the Photo Date Taken etc.
Seemingly at least at least as of mid December 2019 EXIF metadata was in fact still being extracted from content uploaded to SharePoint. This metadata can be surfaced using the RenderListDataAsStream API.
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 the 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 all within a single flow containing less than 10 steps in total, half of which are simply initializing and setting variables comes to a whooping 45-60 seconds on average per 5000 photos processed from a Site Assets Library containing over 10k of photos.
Power Apps & SharePoint Demos with EXIF Image Metadata Extraction
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.
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:
|triggerBody()[‘SendanHTTPrequesttoSharePoint_SiteAddress’]||URL to Site or Subsite||https://tenant.sharepoint.com/teams/multimedia|
|triggerBody()[‘SendanHTTPrequesttoSharePoint-RenderListDataAsStream_Uri’]||Relative path to Document Library and subfolders if desired||/teams/multimedia/masteroffice365/Videos|
/teams/multimedia/Personal Memories/GEO Mapped Photos
|triggerBody()[‘SendanHTTPrequesttoSharePoint-RenderListDataAsStream_Uri_1’]||Document Library Name||Videos|
|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
“ViewXml”: “<View Scope=\”RecursiveAll\”>
<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’ />
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' />
Simply import the Power Automate flow shared below.
By all means contact me should you require assistance with any of your own requirements.
Download the Power Automate flow
Download the Power Apps & SharePoint Demo with EXIF Image Metadata Extraction Power Automate Flow template.