Hey there,I want to add a condition to only Get Mails on receivedDateTime < received datetime minus 10 mintues of today’s date

I am using microsoft 365 mailactivites and want to add thisquery to filter emails

"[ReceivedTime] >= '" + DateTime.Today.ToString("d"). AddMinutes(-10)"

Regards,
Arivu

Hi,

Can you try the following filter string?

Get mails after Today midnight until 10 minutes ago.

"receivedDateTime lt '"+Now.AddMinutes(-10).ToString("yyyy-MM-ddTHH:mm:ss")+"' and receivedDateTime ge '"+Today.ToString("yyyy-MM-ddTHH:mm:ss")+"'"

Get mails after 10 minute ago

"receivedDateTime ge '"+Now.AddMinutes(-10).ToString("yyyy-MM-ddTHH:mm:ss")+"'"

Regards,

Hello ,

I am getting an invalid filter clause error for both of these filter strings, could you help

Hi,

Sorry, it seems necessary to set as UTC. Can you try as the following?

"receivedDateTime lt "+DateTime.UtcNow.AddMinutes(-10).ToString("yyyy-MM-ddTHH:mm:ssZ")+" and receivedDateTime ge "+Today.ToUniversalTime.ToString("yyyy-MM-ddTHH:mm:ssZ")

"receivedDateTime ge "+DateTime.UtcNow.AddMinutes(-10).ToString("yyyy-MM-ddTHH:mm:ssZ")

Regards,

HI,

It seems matter of double quotation position. Can you try the following?

"receivedDateTime ge "+DateTime.UtcNow.Addminutes(-10).ToString("yyyy-MM-ddTHH:mm:ssZ")+" and subject eq 'Test'"

Regards,

@Yoichi , Thank You this helped to fix this issue.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.