Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Power Automate Email Search Query Filter Guide

· 5 min read · Home Automation

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To filter emails in Power Automate, use the Search Query field in the Get emails action (or Get emails (V3)) with a query written in the same syntax as Outlook's search box. For example, from:alerts@example.com AND subject:invoice returns only messages from that sender with "invoice" in the subject. You need a Microsoft 365 work or school account, a flow with an email trigger or action, and basic familiarity with the flow designer. The exact labels in the action may differ slightly by connector version or region.

What You'll Need

  • A Microsoft 365 work or school account (personal accounts have limited connector support).
  • Access to Power Automate (make.powerautomate.com or the desktop app).
  • A flow containing the Office 365 Outlook Get emails action, or a trigger such as When a new email arrives where you can add a search filter.
  • The folder name or ID you want to search (for example, Inbox or a subfolder).
  • A clear idea of the sender, subject keyword, or date range you want to match.

Step-by-Step

  1. Open your flow. Go to make.powerautomate.com, sign in, and open the flow you want to edit (or create a new automated cloud flow).
  2. Add or select the email action. If you are starting fresh, add the Office 365 Outlook connector and choose Get emails (V3). If you already have a When a new email arrives trigger, you can either add a separate Get emails action or use the trigger's own filtering options.
  3. Choose the folder. In the Get emails action, set Folder to the mailbox folder you want to search. Leave it as Inbox if that is where the messages land.
  4. Find the Search Query field. Expand Advanced options and locate Search Query (sometimes labelled Search query). This is where the filter goes. If you are using the trigger, look for Subject Filter or From fields instead; those are simpler but less flexible.
  5. Write the query using Outlook search syntax. The Search Query field accepts the same keywords you would type in Outlook's search box. Common examples:
    • from:boss@example.com – messages from one sender.
    • subject:"weekly report" – exact phrase in the subject (quotes keep words together).
    • from:alerts@example.com AND subject:invoice – both conditions must match.
    • received>=2024-01-01 – messages received on or after a date. Use the ISO format YYYY-MM-DD.
    • hasAttachments:true – only messages with attachments.
    • body:refund – keyword anywhere in the body.
  6. Combine conditions carefully. Use AND to require both terms and OR to accept either. Parentheses group terms: (from:a@example.com OR from:b@example.com) AND subject:urgent. Without parentheses, the connector may interpret the query differently than you expect.
  7. Set the result limit. In the same action, set Top Count (or Top) to the maximum number of messages you want returned. A low number keeps the flow fast; a high number may hit connector throttling.
  8. Test the query. Save the flow, then use Test in the designer. Check the run history and open the Get emails action's output to confirm only the expected messages appear. If the output is empty, simplify the query to a single condition and test again.
  9. Use the filtered results downstream. Add an Apply to each loop over the returned value, then add actions such as Send an email, Create file, or Post message to process each matching message.

Common Mistakes

  • Using SQL-style syntax. The Search Query field expects Outlook search keywords, not WHERE clauses or LIKE operators. Queries like subject LIKE '%invoice%' will not work.
  • Forgetting quotes around phrases. subject:weekly report may match messages containing either word; subject:"weekly report" matches the phrase.
  • Wrong date format. Use YYYY-MM-DD. Regional formats such as DD/MM/YYYY can be misread.
  • Searching the wrong folder. A query only searches the folder you selected. If messages are filed by rule into a subfolder, point the action there or search the whole mailbox where supported.
  • Assuming the trigger filters the same way. The When a new email arrives trigger's Subject Filter is a simple contains match, not full search syntax. For complex filters, use a Get emails action after the trigger.
  • Ignoring case and accents. Outlook search is generally case-insensitive, but accented characters and special symbols can behave inconsistently. Test with plain ASCII terms first.

Tips

  • Start with one condition, confirm it returns results, then add more conditions one at a time.
  • Use received rather than sent when you care about when the message arrived in your mailbox.
  • Keep queries short. Very long queries with many OR terms can time out or return partial results.
  • If you need to search across multiple folders, run separate Get emails actions or use a condition to branch.
  • Store frequently used queries in a compose action or environment variable so you can reuse them without retyping.
  • Check the run history after each change; the action's raw outputs show exactly which messages matched.

Troubleshooting

  • No results returned. Remove all conditions except one, test, then add them back. Verify the folder contains matching messages by searching manually in Outlook.
  • Flow fails with a query error. Check for unbalanced quotes or parentheses. Simplify to a single keyword and retest.
  • Too many results. Add a date condition such as received>=2024-01-01 or lower the Top Count.
  • Results include unwanted messages. Tighten the query with AND and quoted phrases. Remember that body: searches message text and can match quoted replies.
  • Action times out. Reduce Top Count, narrow the date range, or split the flow into smaller runs.
  • Permissions error. Sign out and back in to Power Automate, and confirm the Office 365 Outlook connection is authorised. Recreate the connection if needed.

Frequently Asked Questions

Can I use wildcards in the Search Query field?

Outlook search supports the asterisk (*) as a wildcard in some contexts, but behaviour varies by connector version. For reliable results, use exact words or quoted phrases instead of wildcards.

Does the Search Query field search attachments?

It can match attachment filenames in some cases, but it does not search inside attachment contents. To filter by attachment name, test with attachment:filename.pdf and confirm in the run output.

Can I search multiple mailboxes at once?

No. Each Get emails action targets one mailbox connection. To search shared mailboxes, add a separate action with a connection that has access to that mailbox.

Why does my query work in Outlook but not in Power Automate?

The connector uses a subset of Outlook search syntax. Features like natural-language queries or saved searches may not be supported. Stick to keyword, sender, subject, date, and attachment filters.

Is the Search Query field case-sensitive?

Generally no. Outlook search treats keywords case-insensitively, though exact behaviour can depend on the connector version and server settings.