How to filter messages in Get outlook mail messages

In this “[From]='Uipath Helpdesk’”, second single quote is not proper.
It should be “[From]=‘Uipath Helpdesk’”.

Hi all,

We need to use the below format:

“@SQL=” + “”" + “urn:schemas:httpmail:subject” + “”" + " like ‘%question%’"

All these formats can be found here: Chapter 11: Searching Outlook Data | Microsoft Docs

PFA sample workflow.

_Test_OutlookMail.xaml (5.3 KB)

Many thanks,


Good one @PragmaticProgrammer

1 Like

Thanks Hiren!!! This was really helpful.

1 Like


i would like to filter my mails before downloading the attachement, but the Expression isnt`t working. Do you have any idea?
thanks in advance


Please try this expression “[From]”

Vivek S.

1 Like

Nice one. And is it possible to combine two or more conditions on that row?
Something like:
“@SQL=” + “”"" + “urn:schemas:httpmail:subject” + “”"" + " like ‘%question1%’" or “@SQL=” + “”"" + “urn:schemas:httpmail:subject” + “”"" + " like ‘%question2%’"

1 Like

After “or” I think you should skip the “@SQL=”. I have not tested it but it looks wrong to me.


Thank you for your idea, this way it’s working fine now:
“@SQL=” + “”"" + “urn:schemas:httpmail:subject” + “”"" + " like ‘%stringOne%’ or “+ “””" + “urn:schemas:httpmail:subject” + “”"" + " like ‘%stringTwo%’"

1 Like

Hey everyone,
I am still having this problem with using the filter inside the “Get Outlook Mail Messages” activity.

I was looking through all the forum and this post seems to be the most promising, but although I read through this post twice, I can’t seem to figure out this filter property. I was also trying out most of what I read here and saw the UiPath video about Email automation.
Disclaimer: I am an absolute Rookie with VBA/SQL as well as UiPath.

So I want to basically just prefilter my messages regarding the subject “Daily HUB Report” and preferably only emails that arrived today. Can someone help me and point me in the right direction??

I would highly appreciate it! :kissing_heart:

Try this, it will match mails with the subject line exactly as you mention and only received today:

“[subject]=‘Daily HUB Report’ AND [ReceivedTime] >= '” & now.ToString(“yyyy/MM/dd”) & "’

Hi Bobpeers,

thank you for your fast response. But are you sure there is no syntax mistake in your spelling?, because if I copy the complete line there is already a compiler error!?

You need to enclose the entire statement in quotes for it to work.

Hey bobpeers,

I know this sounds stupid but I don’t understand the syntax of where and when to mark quotes. Can you post how it would look like or elaborate in detail?

1 Like

@maurpalmenice Try below one

“[subject]=‘Daily HUB Report’ AND [ReceivedTime]>=’”&now.ToString(“yyyy/MM/dd”)&"’"

I just made this filter and it works for me

1 Like

Ok, it now works for me. Thank you @bobpeers and @Manjuts90 For everybody else with the same Problem. Don’t Copy the text out of the community forum and directly into the filter. You actually have to write it yourself as different fonts or something yield a problem.

Hi Vvaidya,
I am struggling with filtering only emails that have .xls or .xlsx as attachment… Could you please help me in this matter?
I would appreciate it.

Thanks in advance.

I have it!
For those who need it:
just put this into the Filter field: “[attachment]=’.xls’ OR [attachment]=’.xlsx’”
:slight_smile: happy coding!