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 / use 'list files in fol...
Power Automate
Answered

use 'list files in folder' and "apply to each" for file copy in onedrive

(0) ShareShare
ReportReport
Posted on by

hi there I have a very simple question:

 

I want to list all files in a one drive directory and copy them to a dynamic new directory (a backup procedure) 

 

the output of list all files looks OK to me :

 

{

   "statusCode"200,
    "headers": {
        "Cache-Control""no-cache",
        "Pragma""no-cache",
        "x-ms-request-id""ec76addc-c07a-480e-b2fb-7600749e3494",
        "X-AspNet-Version""4.0.30319",
        "X-Powered-By""ASP.NET",
        "Timing-Allow-Origin""*",
        "x-ms-apihub-cached-response""true",
        "x-ms-apihub-obo""false",
        "Date""Sun, 15 Oct 2023 14:35:23 GMT",
        "Content-Type""application/json; charset=utf-8",
        "Expires""-1"
    },
    "body": {
        "value": [
            {
                "Id""b!WeQ70c3UgUiPGKj2lNmCpLRuPAbFD89BkPdvrZuJT0R6hHK2iF-iQrPiUL343mPV.01FQY4PIEB6JOB2BDLO5FYJDTXOFXXGOMM",
                "Name""4week_delta.xlsx",
                "NameNoExt""4week_delta",
                "DisplayName""4week_delta.xlsx",
                "Path""/drives/b!WeQ70c3UgUiPGKj2lNmCpLRuPAbFD89BkPdvrZuJT0R6hHK2iF-iQrPiUL343mPV/root:/power BI dashboard/_current/4week_delta.xlsx",
                "LastModified""2023-09-05T15:49:51Z",
                "Size"157757,
                "MediaType""application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
                "IsFolder"false,
                "ETag""\"{1D5CF281-6B04-4B77-848E-77716F73398C},22\"",
                "FileLocator""b!WeQ70c3UgU................
 
But appy to each cannot handle the result 
 
I entered value as parameter and this is the result :
 
The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@items('Apply_to_each_2')' is of type 'Object'. The result must be a valid array. 
 
what is wrong with this set up?

 

Categories:
I have the same question (0)
  • ManishSolanki Profile Picture
    15,091 Super User 2025 Season 2 on at

    Hi @Anonymous 

     

    Pls choose the value object dynamically from List files in folder action as shown below:

    ManishSolanki_0-1697386819310.png

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

    Thanks

  • Verified answer
    Community Power Platform Member Profile Picture
    on at

    Indeed, using "value" in the inner "apply to each step" does the trick. "Id" is then used in the copy step itself. 

     

    thanks for the fast response  

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 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard