cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
kylep
Level: Powered On

Cannot use Quotes in Search Query for Office 365 Get Emails

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"')

1 ACCEPTED SOLUTION

Accepted Solutions
v-zhos-msft
Level 10

Re: Cannot use Quotes in Search Query for Office 365 Get Emails

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.

View solution in original post

4 REPLIES 4
Super User
Super User

Re: Cannot use Quotes in Search Query for Office 365 Get Emails

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
Level: Powered On

Re: Cannot use Quotes in Search Query for Office 365 Get Emails

@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)

v-zhos-msft
Level 10

Re: Cannot use Quotes in Search Query for Office 365 Get Emails

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.

View solution in original post

panregitt
Level: Power Up

Re: Cannot use Quotes in Search Query for Office 365 Get Emails

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

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (4,784)