Filter outlook email by subject and received date

Hi All,
I tried filter email with following condition.
Subject=mail report(error)
Received date=last two days

I tried the following code, but not working.
“[subject]=‘(mail report(error))’ AND [Received] >= ‘"“dd/MM/yyyy”)+ "’"

I also tried following code:
“@SQL=%today(“dd/MM/yyyy”))% AND urn:schemas:httpmail:subject Like '%” + (ftpexppd_accesslogfile report(Jousetu)) + “%’”

Uipath said I need end of equiation. I dont know where to put comas or double quoation.

If I run it, the error said.
Get Outlook Mail Messages: Cannot parse condition. Error at “@SQL=(urn:schemas:httpmail:subject LIKE …”.

please help.


Try this…

"[Subject] = '(mail report(error))'"+"[Received] >= '"" + DateTime.Today.AddDays(-2).ToString(""dd/MM/yyyy"")"


dont work.
error said
Get Outlook Mail Messages: Cannot parse condition. Error at “[Received]”.

I thought if multiple condition. its need AND, dont know where to put comas and " between AND also


Try this…

"[Subject] = '(mail report(error))' AND [ReceivedTime] >= ' " + now.AddDays(-2).ToString("dd/MM/yyyy") + " ' "


Hi @mohdrahimi.adnan ,

(“Edit: Added .Xaml as demo”)

you can use LINQ combining Subject.Equals and Headers(“Date”) to apply your desired filter:

var_Mails.Where(function(x) x.Subject.Equals("(mail report(error))") AndAlso CDate(x.Headers("Date"))>Now.AddDays(-2)).ToList


On my example (using different Subject) I get a total of 100 mails at the start, and 4 when filtered, that are the mails with the desired subject, and from the last 2 days.

DemoOutlook.xaml (5.7 KB)

Best Regards,

thanks its work.
Thanks a lot.

1 Like

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