O365 GET EMAIL, query filter required

Hi all
I need to filter email as per sender , subject and time means mail should be only todays mail.

from/emailAddress/address eq “xyz@abc.com” and contains(subject, ‘Bill’)"

Can anyone suggest how to mention time , to get today’s mail only
As email wil be everyday at 2am around so… i need today mail only …As a output …

Hi @Shruthika_r ,

you may use DASL query to filter your emails. Here is the expression:

“@SQL=”“urn:schemas:httpmail:fromemail”" = ‘xyz@abc.com’ AND urn:schemas:httpmail:subject LIKE ‘%Bill%’ AND urn:schemas:httpmail:datereceived >= ‘" & Date.Today.ToString(“dd-MMM-yyyy”) & "’"

Thanks,
Anjani

Will this work in o365 get email ?

DASL works with outlook. for O365, you may use filter builder as mentioned in the screenshot:

Hi @Shruthika_r

Can you please try this it should work with O365 Get Mail
"from/emailAddress/address eq ’ xyz@abc.com’ and contains(subject, ‘Bill’) and receivedDateTime eq " + DateTime.Now.ToString(“yyyy-MM-dd”)

Hi @rashmisingh2695

Is not giving error but also not fetching mail.

Can you please try this and let me know if it works

"from/emailAddress/address eq 'xyz@abc.com' and contains(subject, 'Bill') and receivedDateTime ge " + DateTime.Now.ToString("yyyy-MM-dd") + "T00:00:00Z and receivedDateTime le " + DateTime.Now.ToString("yyyy-MM-dd") + "T23:59:59Z"
1 Like

Hi @rashmisingh2695
Thanks for reply .
I even know the mail time it is fixed …
2am till 4.30am and today’s email only …
And bot will run at 4am . Ideally mail will receive 4.05 am.

In that case you can try to modify the time like below

"from/emailAddress/address eq 'xyz@abc.com' and contains(subject, 'Bill') and receivedDateTime ge '" + DateTime.Now.ToString("yyyy-MM-dd") + "T02:00:00Z' and receivedDateTime le '" + DateTime.Now.ToString("yyyy-MM-dd") + "T04:30:00Z'"

thanks @rashmisingh2695

your solution works for , sender,subject and today’s mail

tested, thanks a lot

1 Like

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