cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ISUTri
Frequent Visitor

Loop through a Sharepoint Library and write specific files to a folder

I found this link but it doesn't seem to work for me since I believe my Sharepoint is a Library and not a list:

 

I am rather new to flow/power automate and I'm not really sure how to get this to work.  I have a sharepoint library that has a main folder named "Shared Documents" in that folder are several subfolders (Location A, Location B, etc..) each subfolder has several excel files in it (I only want one with the words ABC... in its file name). 

 

I've created a flow that will download a single file anytime it is updated.  However, I have several folders (and they coulda dd more in the future).  So i wanted to create a flow that would loop through all subfolders and grab all files with ABC in their name and download them. 

 

I can't seem to get the looping/file to work. 

 

This is my latest flow...  any ideas on what I'm doing wrong?  and if this is the wrong place to post this please let me know.

 

Sharepoint_Flow.png

1 ACCEPTED SOLUTION

Accepted Solutions
Jay-Encodian
Community Champion
Community Champion

Hey @ISUTri 

Use the 'Get file content' action configured as follows:

1.pngHTH

Jay

-------------------------------------------------------------------------

If I have answered your question, please mark your post as Solved.

If you like my response, please give it a Thumbs Up

View solution in original post

7 REPLIES 7
Jay-Encodian
Community Champion
Community Champion

Hey @ISUTri 

Can I just check you want the Flow to download a file in SharePoint every time it is updated? If so, you'd simply need to use the SharePoint 'When a file is created or modified (properties only)' trigger action as follows:

a.png

HTH

Jay

-------------------------------------------------------------------------

If I have answered your question, please mark your post as Solved.

If you like my response, please give it a Thumbs Up

 

Thanks for the thought @Jay-Encodian ,

 

I did get it to work when I specify 1 file and say "whenever this is updated/modified" to activate the flow.

 

The issue I have with that is there are multiple files in different folders that I would need to do this for.  And they could be adding more.  So I would like to (if possible) set up 1 flow that loops through all of the subfolders and grabs any file that ha ABC in the file name. 

 

Jay-Encodian
Community Champion
Community Champion

@ISUTri 

I guess you do this to run on a schedule (once per day or similar? otherwise you'd be obtaining and writing a lot of files unless you add some complexity to your existing Flow to check for an ignore existing files... I would not put that in a Flow which is triggered every time a file is updated / deleted.

In the flow running on a schedule do something similar to:

1.png

 

A.png

 

NOTE: This example pulls all the files back... if you've a high number of files you should really use a 'SharePoint View' or OData query as opposed to filtering the data in Flow as I have done here... I did it this way as I think it better explains what you need to do conceptually.

HTH

Jay

-------------------------------------------------------------------------

If I have answered your question, please mark your post as Solved.

If you like my response, please give it a Thumbs Up

Hi @Jay-Encodian 

 

So your idea of emailing the files to me could theoretically work but would require me to create another flow to activate when these file arrive.


So I tried combining these workflows to see what i can get.. So now it looks like I've gotten all of the folders and I can see the files that all have "OSL" in their names. The question I have now is how do I download them? I am getting a "File not found" with "Get File Content using path"

 

So now I'm trying to grab the OSL files that i have found, my next step will be to write them to a folder.

 

Setup that gets that error:

FLOW.png

Jay-Encodian
Community Champion
Community Champion

Hey @ISUTri 

Use the 'Get file content' action configured as follows:

1.pngHTH

Jay

-------------------------------------------------------------------------

If I have answered your question, please mark your post as Solved.

If you like my response, please give it a Thumbs Up

View solution in original post

Hi @ISUTri,

 

Has your problem been solved by @Jay-Encodian's advice?
If your problem has been solved, You could go ahead and mark the post as solved by clicking “Accept as Solution” so that this thread will be marked for other users to easily identify!

Best Regards,
Community Support Team _ Lin Tu

Hi @v-litu-msft , @Jay-Encodian 

 

Sorry for the late response with Christmas and other things going on I've been out of office.

 

It seems to work but when I run it I get some errors where the get file content errors out in the true area with "not Found" do I need to ignore these somehow?

 

LogicApp_Error.png

 

 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,509)