I'm using a OneDrive for Business trigger On New File Created V2. There is a parameter called File identifier which comes from the header value x-ms-file-id. The output is not only the file id but also the driveid in the format: driveId.fileId
Currently I split this string by the dot (.) to get only the fileId part.
I wonder if this is correct behavior?
Hi @SvenG ,
Could you please explain more details about your requirement?
Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Here is what I found, there is no simple way to do this as of now. Here are the two methods I leverage and what I did. I would recommend the alternative as you get more tools in your toolbox. But for a direction solution the first method would get you there:
I use the x-ms-file-id this has the path of the file that is being accessed. Be aware that '/' is '%252f' and a space (' ') is '%2b'. Due to this change in order to use anything with "using path" I had to change this. Using the replace function twice did that for me it would look something like this:
replace(replace(triggerOutputs()?['headers/x-ms-file-id'], '%252f', '/'), '%2b', ' ')
this would provide a file path from parent%252fchildFolder%252fFile%2bNeeded.txt to parent/childFolder/File Needed.txt
Where do you put that double replace function above:
Place it into "Get file metadata using path", the result of "get file metadata using path will result in you having the FileID
You will also see a trigger output called 'Headers'
inside of this, it is a JSON style/formatted list of information about the file that triggered the flow. Make a compose, put headers as the input, make a file and check the running of that flow you will see what I mean. You will see there is
. If you can separate this out with a Filter Array or Select from "Data Operations" this would be the direct path without the need for what was explained in the "First Method". While neither of them is an easy starting point, I would recommend this method, filtering and parsing JSON data is much faster and seems to be used throughout Power Automate. There are numerous explanations of the use of Filter Array and Select throughout both power users' forums.
Both methods: will work on OneDrive or OneDrive for Business.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Join us on June 28 for our monthly User Group leader call!
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!