Retrieve docProps from a .docx file

Inspiration
This question from DanielStrid:I’m trying to get the “File Version” property set for a file in Windows Explorer in a Flow. We have a version handling for documents and would like to have it as Metadata and process files differently in a Power Automate flow depending on version. I can not find the other data, for example “Authors” either.Power Users Community thread: Get File Property ‘Version Number’ for file in Sharepoint (NOT Sharepoint version).
Zip Files
It is probably useful to know that Office Open XML files like .docx are .zip files with XML and other data files, along with a specification of the relationships between them. One of those folders is docProps which contains the core.xml with the properties. Our goal is to retrieve one or all of those properties from the core.xml.Unzip Open Office XML document via File explorer pic.twitter.com/t1zqalvYBc
— Dennis (@expiscornovus) March 20, 2022
Properties method approach
I managed to find two approaches to retrieve the document properties. One is a bit (over)complicated and the other one is a bit simpler. The first approach is the Unzip approach. In this approach we are going to rename the .docx as a zip, extract and retrieve the core.xml from the docProps folder. With some substring functions you are able to find your properties.

Unzip approach
Like mentioned earlier in this blog, the Properties method approach is probably simpler and easier. However, that does not mean we can have some fun and trying the unzip approach with Power Automate :P. In addition to that this setup might be useful for other scenarios as well. That is why I still wanted to share it.





