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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Cannot use Quotes in S...
Power Automate
Answered

Cannot use Quotes in Search Query for Office 365 Get Emails

(0) ShareShare
ReportReport
Posted on by 15

We're trying to search Office 365 emails from last week.  The below query works in OWA, but gives an error in Flow.

(received:"last week")

status: 400

Syntax error: character '"' is not valid at position 22 in '"(received:'"last week"')

Categories:
I have the same question (0)
  • aprildunnam Profile Picture
    704 on at

    The syntax for Flow is different.  In your Search Query of your O365 Get Emails Action use this instead:  received:last week

     

    See the attached screenshot for reference.  That should return emails received last week.EmailsLastWeek.png

  • kylep Profile Picture
    15 on at

    @aprildunnam Thanks for the reply, but that didn't work.  It's runs successfully but doesn't pull any data without the quotes.  Below is the full search query.

     

    (received:"last week")AND(from:email@domain.com)

  • Verified answer
    v-zhos-msft Profile Picture
    Microsoft Employee on at

    Hi @kylep ,

    It seems you want to get the emils which are received last week.

    I have made a test with the received:last week in the Search Query field.

    However the output is [].

    Capture3.PNG
    I suggest you use the ‘Filter array’ here.
    The expression in Compose is: dayOfWeek(utcNow())

    dayOfWeek

    Return the day of the week from a timestamp.

    The expression in 'Filter array' is to get the last sunday: 

    addDays(utcNow(),sub(0,outputs('Compose')),'yyyy-MM-dd')
    4.PNG

    Best Regards,

    Community Support Team _ Zhongys

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • panregitt Profile Picture
    6 on at

    Kylep,

     

    Quotes are special characters so they must be escaped to be included as part of the query text.  Please modify your Search filter text as follows

     

    received:\"last week\"

     

    I have found that for text lookups, the match is literal from the start of the text.  It is not like in outlook that you can type a string and it will find all text that includes the string.  For example in outlook client, if you type subject:val, it will find messages with value, valid, evaluated, oval  in the subject.  If you use the same criteria in flow, it will only match the word val. 

    Pd, and drop the parenthesis

    Cheers

    Fernando

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @panregitt best answer for this issue. thanks

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 791

#2
Valantis Profile Picture

Valantis 568

#3
Haque Profile Picture

Haque 535

Last 30 days Overall leaderboard