cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JohnDickinson
New Member

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

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

 

1 ACCEPTED SOLUTION

Accepted Solutions

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.

 

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

4 REPLIES 4
v-jefferni
Community Support
Community Support

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.

 

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

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.

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.

 

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

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!

Helpful resources

Announcements
Register for a Free Workshop.png

Register for a Free Workshop

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

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (2,283)