Get Outlook Mail message issue Filter by time and subject

Hi, I am new to uipath and having this simple query. When I am filtering both subject and time in “Get outlook mail message” activity facing issues

You can find the below expression:-

" [Subject]= SUCCESS: " + subject and “[ReceivedTime] >= '”+ now.AddDays(-2).ToString(“D”) +"’"

Can you please help me out.
Thanks!

1 Like

fine we can try with this expression
"[Subject] = ‘yourmailsubject’ AND [ReceivedTime] >= ’ " + now.AddDays(-2).ToString(“MM/dd/yyyy”) + " ’ "

or

"[Subject] = ‘yourmailsubject’ AND [ReceivedTime] >= ’ " + now.AddDays(-2).ToShortDateString + " ’ "

hope this would helpyou
Cheers @Ramya12

Hi Palaniyappan

Even after using this expression i am facing still issues like “Condition not satisfied”

"[Subject]=SUCCESS: " + subject AND [ReceivedTime] >= ’ " + now.AddDays(-2).ToString(“MM/dd/yyyy”) + " ’ "
Thanks

1 Like

This looks incomplete buddy
The expression should be like
"[Subject] = ‘SUCCESS:’ AND [ReceivedTime] >= ’ " + now.AddDays(-2).ToString(“MM/dd/yyyy”) + " ’ "

Or may I know what subject we are trying consider here I mean the text we want to filter with

Cheers @Ramya12

You can try this to filter your Outlook emails by subject and date:

“[Subject] = ‘Success’ AND [ReceivedTime] >=’”+Now.AddDays(-2).Date.ToShortDateString+"’ And [ReceivedTime] <= ‘"+Now.Date.ToShortDateString+"’"

Hi monsieurrahul,

Actually, we are using this subject line: “SUCCESS: Blackrock4_to_Markit_PROD - for index_weights files”
In out look filter condition i am using the above expression,but it’s showing error

thanks

Fantastic
kindly try with this expression
"[Subject] like ‘%SUCCESS:%’ AND [ReceivedTime] >= ’ " + now.AddDays(-2).ToString(“MM/dd/yyyy”) + " ’ "

Cheers @Ramya12

image

Above error i am facing.

Below expression i am using in date format it’s showing error like “)” excepted

thanks

1 Like

Fine
kindly type the same expression freshly rather copy and paste,
i could see the double quotes are not taken up in date formatting “MM/dd/yyyy”

Kindly try once again by typing freshly the same expression and let know pls
Cheers @Ramya12

Sorry to ask you these many times,
Still i am facing same error

No worries but, can you clarify your question? You want to filter your emails by the subject ‘SUCCESS: Blackrock4_to_Markit_PROD - for index_weights files’ and date, correct?

If the subject is static, use “[Subject] = ‘Your Subject’ AND [ReceivedTime] >=’”+Now.AddDays(-2).Date.ToShortDateString+"’ AND [ReceivedTime] <= ‘"+Now.Date.ToShortDateString+"’"

If the subject varies each time except for the ‘success’ part then, use “[Subject] LIKE ‘Success %’ AND [ReceivedTime] >=’”+Now.AddDays(-2).Date.ToShortDateString+"’ AND [ReceivedTime] <= ‘"+Now.Date.ToShortDateString+"’"

You can refer this post for a more clear idea: How to filter messages in Get outlook mail messages

Let me know if you’re still facing any issues!

Hi @Palaniyappan and @monsieurrahul. This is what I am trying to achieve,

I want to retrieve all emails from past two days with a particular subject. My subject comprises of two parts where one is fixed and the other is variable. Below is a sample subject

SUCCESS: Blackrock4_to_Markit_PROD - for index_weights files

Here the bold part is constant and rest is variable whose value will be stored in a variable lets say subject. I tried below expression in get outlook mail however it is failing. It would really help me a lot if you can help me with right expression.

" [Subject]= SUCCESS: " + subject and “[ReceivedTime] >= '”+ now.AddDays(-2).ToString(“D”) +"’"

Hi All,

Can anyone please help me out for above Question.
Thanks

Hi @Palaniyappan

I want read emails based on Minutes , kindly provide suggest logic

example : “[ReceviedTime] <= 10 min”

Thanks,
Chinnapu Reddy

“[Subject] LIKE ‘Success %’ - this part of the filter is not working for me. But if i use like “@SQL=” + “”"" + “urn:schemas:httpmail:subject” + “”"" + " like ‘%"+S_EmailSearchFilter+"%’ it is working. My problem is i need to use the date filter along with this and for date filter [ReceivedTime] >=’”+Now.AddDays(-2).Date.ToShortDateString+"’ is the working pattern

If you use urn:schemas:httpmail:subject for the subject filter, than you you can use
urn:schemas:httpmail:datereceived for the REceivedTime:

urn:schemas:httpmail:datereceived >= ’”+Now.AddDays(-2).Date.ToShortDateString+"’