Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 4fPoeTC89WK1EJ1ZgHIJKH
Power Automate - Power Automate Desktop
Answered

Get Emails V3 Search Query

Like (2) ShareShare
ReportReport
Posted on 15 Nov 2024 15:39:04 by 93
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
  • trice602 Profile Picture
    13,768 Super User 2025 Season 1 on 23 Feb 2025 at 21:57:44
    Get Emails V3 Search Query
    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 💯💯💯💯💯
  • trice602 Profile Picture
    13,768 Super User 2025 Season 1 on 23 Feb 2025 at 21:57:14
    Get Emails V3 Search Query
    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 💯💯💯💯💯
  • Verified answer
    trice602 Profile Picture
    13,768 Super User 2025 Season 1 on 15 Nov 2024 at 16:00:17
    Get Emails V3 Search Query
    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

     


     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Power Automate Desktop

#1
eetuRobo Profile Picture

eetuRobo 18 Super User 2025 Season 1

#2
Nived_Nambiar Profile Picture

Nived_Nambiar 10 Super User 2025 Season 1

#3
stampcoin Profile Picture

stampcoin 6

Overall leaderboard