web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Get Emails V3 Search Q...
Power Automate
Answered

Get Emails V3 Search Query

(4) ShareShare
ReportReport
Posted on by 114
Hi,
 
I am unable to find any official documentation on how to structure Search Queries, or examples, and I need to know how to search for emails with multiple criteria. Is anyone aware of documentation that helps, or know if any way of structuring the query? Is it the same as the Power Automated Cloud activity? 
 
For example, I need to filter emails by date received, not from specific email addresses and excluding some attachment types. Is this possible with the Search Query field?
 
Thanks in advance
I have the same question (0)
  • Verified answer
    trice602 Profile Picture
    15,404 Super User 2025 Season 2 on at
    Hi,
     
    There's a lot of documentation out there at Microsoft Learn but here's a quick summary to help you keep going:
     
     
     

    For Power Automate Cloud (Outlook 365 Connector):

    You can use the "Get emails" or "When a new email arrives (V3)" trigger with a Search Query in the advanced settings. The Search Query uses the Microsoft Graph OData query language, and you can filter emails by criteria such as date received.

    Example Search Query Syntax:

    receivedDateTime ge 2024-11-01T00:00:00Z and receivedDateTime lt 2024-11-10T23:59:59Z
    • receivedDateTime ge 2024-11-01T00:00:00Z: Emails received after or on November 1, 2024.
    • receivedDateTime lt 2024-11-10T23:59:59Z: Emails received before November 10, 2024.

    Unfortunately, you cannot directly filter based on attachment types in the Search Query. However, you can process the emails in subsequent steps to exclude unwanted attachment types.

    Steps to Exclude Certain Attachment Types:

    1. Add a Condition:

      • After retrieving the emails, use a condition to check if the attachment name ends with certain file extensions (e.g., .exe, .zip).
      • Example condition: @not(endsWith(item()?['Name'], '.exe'))
    2. Filter Attachments in an "Apply to Each" Loop:

      • Loop through the attachments and skip processing those with the unwanted file types.

    For Power Automate Desktop:

    In Power Automate Desktop, you can:

    1. Use the "Launch Outlook" or "Get Outlook emails" action.
    2. Specify filters such as Date received in the action's settings.
    3. Process the emails in a loop and exclude attachments by checking the file extension in a script or condition.

    Example of Filtering Emails:

    1. Set up a filter to retrieve emails received within a specific date range.
    2. Add a condition to exclude emails containing attachments with specific file extensions:
      • Use a condition: If Attachment Name does not end with ".exe" or ".zip"

    Important Notes:

    • Search Query Limitations: The Search Query in Power Automate Cloud cannot directly exclude attachment types but can filter emails based on metadata like date, subject, or sender.
    • Post-Processing in the Flow: For advanced filtering (like attachment types), implement logic within the flow after retrieving emails.
     
    ------------------------------------------------


    If this was helpful, please like and/or mark as a verified answer to help others find this too!


    Always glad to help! 💯💯💯💯💯

    Tom 

    Follow me on LinkedIn - Thomas Rice, PMP | LinkedIn

     


     
  • trice602 Profile Picture
    15,404 Super User 2025 Season 2 on at
    Hey there!
     
    I am following up on this post get emails v3 search query in this category power automate desktop from 11/15/2024.  I know the post is a little older, but it is a common question here so wanted to take a moment and follow-up. I see there have been 1 replies and 2 likes and asking if your question has been answered.  If so, please help the community out by completing one or more of the following actions!  Thanks in advance!
     
    Easy as 1-2-3 ‼️💯⭐😎🆒🙏
     
    1) Mark a reply as a verified answer - this is essential, and it helps others with the same general question find this thread. ✅
    2) You can also mark one of more replies as a verified answer.  Please take a moment and give the author credit for volunteering their time. ✌️
    3) Like one or more replies.  Kudos always greatly appreciated! 👍
     
    Pro tip:  if you found your own solution or workaround, feel free to add a reply to your own post and mark it as the solution too!  The goal is to get this thread marked with a verified answer by anyone that finds one or more replies helpful!
     
    Again, thanks in advance for reading and responding, always glad to help!  Tom 💯💯💯💯💯
  • trice602 Profile Picture
    15,404 Super User 2025 Season 2 on at
    If I can help with anything else please let me know or tag me in a future post, I enjoy reading and answering questions.  Always glad to help!  Tom 💯💯💯💯💯
  • Suggested answer
    Watever Profile Picture
    75 on at
    Sorry to answer an old post but when I was searching for a solution I found this post.
    Unfortunately, the answer doesn't work.
     
    Search query is not the same as a Q Query/Filter for other power automate step.
     
    The pattern is received>2022-01-01 AND received<2024-01-31 or if you want a specific day use a : instead of < or >
     
    It took me sometime to find it as I was also trying to use LT or GT like we do for a filter query.
     
    Hopefully it helps others.

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.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard