Filter Specific Subject in Get Exchange Mail Message Activity

i wanted to filter a subject that contains “Merchant” from specific sender in the Get exchange mail Message Activity. Reading all 1000 email consumes more than 20minutes in the run time of the Bot. So i wanted to filter first the email then using for each to download the attached files in the filtered email. Hope you can provide solution. Thanks

Hello @jessie.cris.gallardo ,

Did you had the chance to use the Filter expression option?

Maybe this can help you.
(I did not tested it, I do not have an exchange environment)


Yes, already tried all of these filter and none of these options is working


“Subject eq Merchant”

“[Subject]” like ‘%Merchant %’ "

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

“@SQL=”“”" like ‘%Merchant%’ “

@jessie.cris.gallardo - please share the screenshot of your filter properties?

Hi @jessie.cris.gallardo

welcome to community

You can try this approach:

  1. Read the mails using Get Exchange mail activity and store in mails variable.

  2. Now use the below linq query using assign activity

mails= mails.Where(Function(mail) mail.Subject.ToString.Contains(“Merchant”)).ToList()

the after the assign activity, mails variable will only contain the mail which had subject containing Merchant in it.

Nived N
Happy Automation

Hi Nived,

Thanks for this solution, however reading all 1500 emails takes more than 20minutes, and the actual processing of the Bot after reading the email will only take 5minutes, thus reading all the email consumes a lot of time. So i wanted to filter first all the emails in Get exchanged mail so that i can use the other time running different processes in prod.

Hello Jessie,
Since I am having the same situation I was wondering if you did find a solution?
I was hoping I can use SQL query in Exchange activities as well.

Please refer to this link on filter email.

1 Like

Yea, I found it as well. Haha its funny, I would rather check forum than the actual documentation :smiley:

Did you create some complex filters or?
Because I am trying to create a complex filter and it is not working as expected

Hi @jessie.cris.gallardo

Did you try this ?


“subject:Merchant AND from:""”""

Does anybody got the solution?
I have the same Issue. The Filterexpression works fin in the Outlook-Activity, but doesn’t work in exchange activity. I get no errors by applying this expression, but also get an empty List of email.
Is it ab bug in the Exchange Activity? Should I create a ticket at UIPath Support?

Try “subject:Merchant”.

This query isn’t working. Can you confirm if the syntax is correct?