Skip to main content

How to Filter SharePoint Items with a Filter Query in Power Automate

· 5 min read
Jagdish Kumawat
Founder @ Dewiride

Get items can ask SharePoint for only the items that match a condition, so the flow never downloads the rest. Show its Filter Query advanced parameter and enter an OData filter, such as Status eq 'Pending': the column's internal name, an operator, and the value, with text in single quotes.

Microsoft's in-depth Get items article explains that filter queries filter the items on the server.

The example is Get Waiting Approvals, a flow of the Overtime Timesheet app. It needs only the overtime entries still waiting for a decision, out of every entry ever logged.

Prerequisites​

Step 1: Add Get Items​

Add an action, search for Get items, and choose Get items under SharePoint. I named it Get the pending entries. Set Site Address and List Name.

Step 2: Show the Filter Query Parameter​

Open Advanced parameters and tick Filter Query, or select Show all to show every option.

Step 3: Write the Filter​

Enter the condition:

Get the pending entries → Filter Query
Status eq 'Pending'

The Get the pending entries pane with Site Address and List Name set to environment variable tokens, and under Advanced parameters showing 6 of 6: Filter Query Status eq 'Pending', Order By StartTime, Top Count 5000, Limit Columns by View, Limit Entries to Folder and Include Nested Items, connected to Overtime Timesheet SharePoint

Each part:

  • Status is the column's internal name, the name SharePoint gave it when it was created. Microsoft's article shows that spaces in it become _x0020_, such as Start_x0020_Date.
  • eq means equals. The article lists lt, le, gt, ge, eq and ne for numbers, and startsWith, substringOf, eq and ne for text.
  • 'Pending' is text, so it goes in single quotes.

Combine conditions with and or or, as in the article's Location eq 'Midwest' and Status eq 'Approved'.

The Result​

In a run, Get the pending entries returned four entries, all with Status Pending. Approved and rejected entries never left SharePoint.

What It Can't Filter​

Not every column type can be filtered. A Person column that allows several people can't, as Microsoft's SharePoint REST article says: there's no way to query for them. Filter those in the flow (How to Check If a Person Is in a Multi-Person Column in Power Automate).

On a large list, filter on a column that's indexed (How to Index a Column in a SharePoint List), and read How to Sort SharePoint Items and Get More Than 100 in Power Automate for the limits on how many items come back.

Common Mistakes​

MistakeWhat happensDo this instead
Using the display name of a renamed columnSharePoint doesn't find the columnThe internal name
Leaving out the single quotes around textThe value isn't written as textStatus eq 'Pending'
Getting every item and filtering with Filter arrayEvery item is downloaded firstFilter Query on Get items
Filtering a multi-person columnNot supportedFilter in the flow

Troubleshooting​

SymptomLikely causeFix
The action fails on the column nameWrong internal nameCheck the name in the column's settings address
Nothing comes backThe value doesn't match exactlyCompare with an item's value in the run
Too few items on a big listNo match among the first 5,000Turn on pagination (see the sorting how-to)

FAQ​

How do I find a column's internal name?​

In the list's settings, select the column: the end of the page's web address shows Field= and the internal name.

Can I use dynamic content in the filter?​

Yes. A token or expression inside the quotes, such as Title eq '<token>', filters on a value from earlier in the flow.

Conclusion​

Filter Query on Get items makes SharePoint return only the matching items. Write it as an OData filter with the column's internal name, such as Status eq 'Pending', and filter multi-person columns in the flow instead.

Additional Resources​