cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper III
Helper III

Get of Subfolders Onedrive

Hello to all. Thank you very much for your help.
I am building a flow for Onedrive.
I have different folder levels (Main folder (level 1), subfolder (level 2), subfolder (level 3), like this

Folder1-->Folder2-->Folder3.

In each of them, there are files.
How can I browse through everything and get information from the files in each level?
So far I have this, but I can't get it to go through all the levels.
Thank you very much.

 

elaaadani_0-1606419884671.png

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @elaaadani 

 

So to do append all the three folder values in one JSON you need to replicate the List Files in Folder, Apply to Each loop, Condition, Compose and Append Array variable three times. This will go under the each IF conditions. Finally you end up having 3 nested Apply to Each loop.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials

View solution in original post

10 REPLIES 10
Super User III
Super User III

Hi @elaaadani 

 

The first list files in folder returns a property called IsFolder. Check this condition to iterate the next level. Again you may add List Files in Folder under the Apply to Each loop. You mentioned you have three folder levels so you end up having three apply to each within each loop with an IF condition to get all the files.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials

Thank you very much @abm ! It worked. One last question.
How can I put the result of those 3 outputs in a json ? Could you help me with that please

Hi @elaaadani 

 

Delcare an array variable outside the apply each loop. Then under each loop where you retrieve the files, construct your JSON format in a compose statement. Next step add the Append to Array action step.

Following are the Power Automate action steps you need.

 

1. Declare an array variable

2. Compose to construct the JSON format you want.

3. Append Array

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials

Hi @abm 

Thank you so much. Can you give me an example of the Compose to construct the JSON format just with Id, name and path .
Thank you

Hi @elaaadani 

 

Thanks for your reply. Follow the below steps.

 

image.png



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials

Hello @abm 

I am very grateful for your help. Sorry for so many.
When I go through the contents of a folder, in "body" I get the collection I need. But that collection of one, I need to be able to join it with the "body" of another one

elaaadani_1-1606441224356.png

 


like this

 

elaaadani_0-1606441004341.png

How can I achieve that?

Hi @elaaadani 

 

Add a Parse JSON step to pass your current value array. Iterate the value, use the compose and append array to construct the JSON you want.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials

@abm But the value for each element I have is different. I don't understand.
I want to put the 3 values together in one json. I don't understand how it is, sorry

Hi @elaaadani 

 

So to do append all the three folder values in one JSON you need to replicate the List Files in Folder, Apply to Each loop, Condition, Compose and Append Array variable three times. This will go under the each IF conditions. Finally you end up having 3 nested Apply to Each loop.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials

View solution in original post

@abm Everything worked perfectly. I am very grateful, for the time you have dedicated to teaching me. Thank you very much for all the help and patience ! Have a nice weekend

Helpful resources

Announcements
PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Users online (4,486)