cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

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
Highlighted
Solution Sage
Solution Sage

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
Highlighted
Power Participant
Power Participant

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

Highlighted
Frequent Visitor

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)

Highlighted
Solution Sage
Solution Sage

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

Highlighted
New Member

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (6,462)