I want to get a list of the files in a OneDrive for Business subfolder, where the subfolder is a dynamic value. The path from the root is /fixedname/<dynamic value>. There are no files in /fixedname, only subfolders. And those subfolders will only have files, not additional subfolders.
I know that to get the ID of that subfolder, I have to go through a few steps before I can use the Get List action of the actual subfolder. The approach I was trying is:
- List Files in Folder on the static part - /Initial Grant Request in example below
- Filter Array on the 'value' array produced by List Files, with condition item()?name = 'dynamicname'.
- Then, I'd hoped that would give me just the element from that array that matches my subfolder, I can look at the ID, and then
- List Files in Folder using that ID, which would give me the list of files I want.
The test flow starts like this:
And in a test run (according to the Compose I inserted - body('list_files_in_folder')) the List Files does give me what looks like a 'value' array:
{
"value": [
{
"Id": "b!QxmkTU0IcUKwSTGqXhyybBtwH90DHyBEll5ukVqwLounIAZ-qbvMSZVMM_ICpWk3.01ULAD262XE4LCWT5FANGZ7XKCSEQ7BYBC",
"Name": "A Tree Falls, Inc. 05-19-2025",
"NameNoExt": "A Tree Falls, Inc",
"DisplayName": "A Tree Falls, Inc. 05-19-2025",
"Path": "/drives/b!QxmkTU0IcUKwSTGqXhyybBtwH90DHyBEll5ukVqwLounIAZ-qbvMSZVMM_ICpWk3/root:/Initial Grant Request/A Tree Falls, Inc. 05-19-2025",
"LastModified": "2025-05-19T16:44:54Z",
"Size": 13387,
"MediaType": "application/octet-stream",
"IsFolder": true,
"ETag": "\"{2B162757-A54F-4D03-9FDD-429121F0E022},6\"",
"LastModifiedBy":...
etc. 6 entries, matching the 6 subdirectories.
It's the Filter Array that I'm stumbling on. No matter what I enter in the From field, such as Copilot suggestions:
body('list_files_in_folder')
body('List_files_in_folder')?['body]?['value']
and variants such as wrapping in an expression using json(), or as in the test run above the Output of the Compose, the Filter Array action refuses to recognize it as an array.
I'm missing something silly. I'm sure I can solve this inside a For Each loop, and then test each Name, but yikes this seems more complicated than it should be. Is there an alternate approach I should be using? thx