How to Filter Emails by Subject in Power Automate

Posted by

Filtering emails by subject in Power Automate seems simple at first. Just add a subject filter or search query, and your flow should find the emails you need. In practice, though, it’s a little trickier. Here’s what I learned and how to reliably solve it.

The Problem

I wanted my flow to pick up emails based on their subject. For example, any email whose subject contains:

“Action required reminder”

However, using Power Automate’s Get emails (V3) action with the subject filter returned nothing — even though the emails were clearly in my Inbox.

At first glance, it seemed like a syntax or configuration issue, but the problem was more subtle.

What I Tried

  1. Exact Subject Filter
    Setting the subject filter to exactly "Action required reminder" fails if the actual subject has extra text appended, like: Action required reminder: Review your security info Exact matching does not work with dynamic or partial subjects.
  2. Graph Search with Double Quotes
    Using the searchQuery field with Graph syntax: "searchQuery": "subject:\"Action required reminder\"" caused a syntax error: Syntax error: character '"' is not valid at position ... The connector does not accept nested double quotes, which breaks the flow.
  3. OData Functions
    Attempts to use startswith() or contains() in the search query failed because Get emails (V3) does not support OData functions, only simple Graph search syntax is supported.
  4. Folder Path and Focused Inbox Issues
    Emails in subfolders, Focused/Other inboxes, or Junk/Clutter could also be invisible to the flow.

The Solution

The fix is simple: use single quotes in your search query. This avoids syntax errors and reliably matches the subject text.

"searchQuery": "subject:'Action required reminder'"

This approach:

  • Works for any subject, even if extra text is appended.
  • Avoids JSON and Graph parsing errors.
  • Works reliably in Get emails (V3).

Making it bulletproof

Because some email subjects can include punctuation or extra spaces, it’s safest to combine the search with a Filter array step in Power Automate:

@contains(toLower(item()?['subject']), 'action required reminder')

This ensures:

  • Case-insensitive matching
  • Partial matching anywhere in the subject
  • Compatibility with all tenants and folders

Leave a Reply

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