How to order SharePoint items returned by ‘Get items’ in Power Automate

“Is it possible to use multiple fields in the ‘Order By’ Power Automate OData filter on a SharePoint ‘Get items’ action?  i.e. sort by Title and Date field?”


Power Automate action ‘Get items’ will always return the SharePoint items in an order, by default ascending by ID – the oldest items first. In most situations the order doesn’t really matter, but there’re some cases when it does. For example, if you export the SharePoint list items into an HTML table, it makes sense to sort it differently. It’s always easier to read an export if you group the related items together, e.g. requests for a specific user.

Since Power Automate doesn’t have an action to sort an array later, you should sort the results right away. There’s a workaround to sort an array, but with SharePoint items it’s an extra work. If you can sort the items directly in ‘Get items’, you should do it.

‘Order By’ format

The expected format of the ‘Order By’ field is very simple. Type in the SharePoint column internal name and the order: asc for ascending or desc for descending.

e.g. ascending by Title
Title asc
Order SharePoint items in Power Automate

If one column is not enough, you can order by multiple columns, just separate the columns and order by a comma. The sorting priority will be from the left to the right.

e.g. ascending by Title, then descending by DateTime
Title asc, DateTime desc
Order SharePoint items Power Automate by multiple columns

Summary

As already mentioned, if you need to sort the items, you should do it right away. The ‘Get items’ action gives you the possibility in the ‘Order By’ field – just define the columns and their sorting order.

And if you’d like to filter the items before that, take a look on the filtering section on the blog.


Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

Add a Comment

Your email address will not be published. Required fields are marked *