Announcements
You need to sort the body array, not the entire action output. Try:
sort() only sorts in ascending order, so reverse() gives you the latest files first. If your connector supports Order By, using LastModified desc is an even better option since the sorting happens at the source.
sort()
reverse()
LastModified desc
The issue is that you're trying to sort the entire response body instead of the array of files.
The List files in folder action returns the files in the value array. Try sorting that array instead.
value
For example:
take( sort( body('List_files_in_folder')?['value'], 'LastModified', 'Descending' ), 25 )
If this still returns no results, check the following:
Verify that LastModified is the correct property name returned by the action. Depending on the connector (OneDrive, SharePoint, etc.), it may be named LastModifiedDateTime, TimeLastModified, or something similar.
LastModifiedDateTime
TimeLastModified
Add a Compose action with:
body('List_files_in_folder')?['value']
and inspect the output in the run history to confirm the available property names.
If you're using the SharePoint Get files (properties only) action, you can often avoid expressions altogether by using the built-in Order By field with:
Modified desc
which is more efficient than sorting after retrieval.
If you can share which connector you're using (SharePoint, OneDrive, Azure Blob, File System, etc.) and a sample output from List files in folder, I can suggest the exact expression.
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.
Jump in, show your community spirit, and win prizes!
Expanding mentorship, skilling, and AI innovation
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Valantis 377
11manish 279
David_MA 234 Super User 2026 Season 1