cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

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

Hey @Anonymous 

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 @Anonymous 

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

 

Anonymous
Not applicable

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. 

 

@Anonymous 

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

Anonymous
Not applicable

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

Hey @Anonymous 

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

Hi @Anonymous,

 

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

Anonymous
Not applicable

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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (4,587)