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 can I convert the ...
Power Automate
Unanswered

How can I convert the output of a "List files in folder" action from an object to an array?

(0) ShareShare
ReportReport
Posted on by 42

Hi. Very new to Power Automate and expressions. I am trying to get a list of files and folders in a target OneDrive folder and filter out the file names to end up with a list of folder names only.

 

The ultimate goal is to compare those folder names with a string extracted from an email (which I have figured out how to do), and IF there is a match, save the email as a .eml file into the folder whose name matches the word extracted from the email.

 

I've worked out a series of steps to achieve this goal, but I am currently stuck at filtering the list of files and folders... I need to convert the result to array first apparently, but I do not understand how to do that. I have asked Copilot but none of its solutions work. And everything I find online either doesn't work or isn't suitable for this task. Any help with this would be greatly appreciated!

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

    Hi ,  @DanJECC 

    According to your description, you want to convert the "List files in folder" action from an object to an array.

    This is my output of my "List files in folder" action:

    vyueyunmsft_0-1710725185867.png

    For example , if you want to make all the [Name] in an array , you can just use this expression:
    xpath( xml(json(concat('{"root":{"item":',outputs('List_files_in_folder')?['body/value'],'}}'))) , '/root/item/Name/text()')

     

    Then we can get an array of [Name]:

     vyueyunmsft_1-1710725342883.png

    If this reply can help you , you can click mark this reply as solution (Accept solution) which can help more people, thanks in advance! 

     

    Best Regards,

    Yueyun Zhang

     

     

     

     

     

     

  • DanJECC Profile Picture
    42 on at

    Ahh, excellent. Is there a way to simultaneously filter the list of names to only include the folder names? Or does that require an additional step?

  • Verified answer
    v-yueyun-msft Profile Picture
    on at

    Hi , @DanJECC 

    If you want to just extract the folder names like this:

    vyueyunmsft_0-1710726375373.png

     

    You can try to use this expression:
    xpath( xml(json(concat('{"root":{"item":',outputs('List_files_in_folder')?['body/value'],'}}'))) , '/root/item[IsFolder="true"]/Name/text()')

    If this reply can help you , you can click mark this reply as solution (Accept solution) which can help more people, thanks in advance! 

     

    Best Regards,

    Yueyun Zhang

     

     

     

     

  • DanJECC Profile Picture
    42 on at

    Amazing! That does exactly what I need to do. Next step is to string match that output to see if a specific folder exists, but I think I have what I need for that. Thank you very much for your help.

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

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard