I almost have this working but I am stuck on getting the folder created.
I am keeping two ODFB (OneDrive for Business) location in sync. I have one Trigger and One Action in the Power Automate Flow.
1. (Trigger) When a file is Created in Source
2. (Action) Create a file in Destination
The action requires 3 properties to work (a) Folder Path (b) File name (c) File content. (b) and (c) I can get from the Trigger.
For (a) the Folder Path I need to create the folder path if it does not exist. This works if I supply a folder name that doesn't exist then it will create it. I am using an expression as follows to create the folder:
last(split(base64ToString(triggerOutputs()?['headers']['x-ms-file-path-encoded']),'root:/'))
This creates a folder but the folder it creates is the name of the file rather than just the folder path. For example, if the name of the file it is supposed to create is "somefile.txt" in "FolderX". Then it will create a folder as follows in the ROOT (/) -> /folder1/folder2/somefile.txt/somefile.txt
The file is created but it is created inside a folder.
How can I use my expression in the File path property to create /folder1/folder2/somefile.txt folder path instead?
Solved! Go to Solution.
Please consider accepting my answer as a solution if it helps to solve your problem.
Cheers
Damien
Please take a look and subscribe to my YouTube Channel for more Power Platform ideas and concepts, or take a look at my website. Thanks
Please consider accepting my answer as a solution if it helps to solve your problem.
Cheers
Damien
Please take a look and subscribe to my YouTube Channel for more Power Platform ideas and concepts, or take a look at my website. Thanks
Thanks very much for replying. Just to try clarify - do you mean to replace my expression completely with the suggested expression?
Or to run your suggested expression after on the outputs from mine?
Hi @m0p0h0
Run the expression on top of your existing. I’ve assumed it’s in a compose action.
You could alternatively replace both outputs(‘compose’) with your expression.
Damien
This worked like a champ. Thanks for taking the time.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
User | Count |
---|---|
12 | |
10 | |
10 | |
9 | |
6 |
User | Count |
---|---|
26 | |
20 | |
12 | |
10 | |
10 |