web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to loop through fi...
Power Automate
Unanswered

How to loop through files in a OneDrive folder and create and log share links in a spreadsheet

(0) ShareShare
ReportReport
Posted on by 9

I seem to be missing something on how to iterate through the files in a Onedrive business folder and do something based on each file. I tried and gave up in the past but am trying again.

  • Given a OneDrive folder with about 100 files I need to create a sharing link (view only) for each file and store that link in a spreadsheet for another program to process
  • I can get a share link for a single file, and add it to an existing spreadsheet along with the file name just fine
  • I just cannot seem to figure out how to go from "List files in folder" to "apply to each"

1) Can anyone show me ALL the steps that gets and loops through all the files in a folder, i.e. show me a working apply to each file example, or point me two one? (Later I can add copying, renaming and other changes to the files using functionality I already know how to use.)

2) Also, when I add a Create share link inside the 1st apply to each and then follow with add a row into a table the cloud interface insists on nesting it in another apply to each control. You can see in the image included. Can anyone explain this to me or point me at documentation?

JohnDickinson_0-1648343994300.png

 

Categories:
I have the same question (0)
  • v-jefferni Profile Picture
    on at

    Hi @JohnDickinson ,

     

    For the first question, I can use both "create share link by path" and "create share link" to create the URL:

    vjefferni_0-1648548487024.png

    vjefferni_2-1648548644045.png

     

    11 files are in the folder:

    vjefferni_1-1648548526732.png

     

    For the second question, I used the same action but no apply to each was added:

    vjefferni_3-1648548930879.png

    Please check the field values you selected from dynamic contents if they are from the list files action.

     

    Hope this helps.

     

    Best regards,

    Community Support Team _ Jeffer Ni
    If this post helps, then please consider Accept it as the solution to help the other members find it.

     

  • JohnDickinson Profile Picture
    9 on at

    Thanks for reaching out. Can you show what variable you are initializing in the second step and expand the dialog for the Apply to each as that is where I cannot seem to get it to have a list to work through. What precisely are you giving the Apply to Each to loop through that was returned from the "List Files in Folder" call.

  • Verified answer
    v-jefferni Profile Picture
    on at

    Hi @JohnDickinson ,

     

    Actually the variable is not relevant at all, I have nothing in Value when initializing, but use it for the loop and store the URL to check results.

     

    The expanded flow for your reference:

    vjefferni_1-1648689712222.png

     

    Hope this helps.

     

    Best regards,

    Community Support Team _ Jeffer Ni
    If this post helps, then please consider Accept it as the solution to help the other members find it.

     

  • JohnDickinson Profile Picture
    9 on at

    Thanks for this! I haven't fully tested it but now I can see the structure I expect for iterating through the files in a folder as I build the workflow AND a simple test got it to work!

    Much appreciated!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard