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.


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?

1 Like

Try “subject:Merchant”.

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

@Sunny_J What do you mean exactly by “This query isn’t working”?

The syntax “subject:Merchant” is correct, I’ve just tried it and it works.

All the filtering examples described in the official documentation at were checked and they returned correct results (I know this because I was the one creating and testing them). Anyway, the filtering language it is not something UiPath specific, but EWS. For more details check Perform an AQS search by using EWS in Exchange | Microsoft Learn

It’s not working > processes then throws “timout expired error”
Very simple filter expression : “subject:something” and my subject does contain “something” but it doesn’t detect it

My experience with these are for some sujects it is working for some its not.
For example: the subject looks like this “Dep 1262 DZ”
If i use this filter: “subject:1262” it does not find the email.
If i use this filter: “subject Dep 1262 DZ” it finds the email.

And the most funny part is if i turn on the property “OnlyUnreadMessages” it wont find the emails when the full subject is given (the emails are still unread).

On the other hand if the subject looks like this: “Dep 532153031 DZ”
Both filters are working.

Really sketchy :confused:

It´s obviously does not work as intended.
Can you please look into it?

Thank you

Yea I am having similar issues, filter with from:mailadress does not work.

The get messages work when there is no filter.

I have tried to use the mailmessage.from and assigned that value to the the str_filter but that does nothing either.

I have followed the format in your docs to the letter. It should work but it does not and everything else around it works.

You have some bugg here that I hope that you will fix.
Using Enterprise version and I am this close to turning this in to an incident report.

There are 3 things that I’ve noticed.

  1. Try using > subject:“emailaddress”.
    This helped me a lot.
  2. But be careful, I think that UiPath.Mail activities older versions have some bug issues, so make sure you are using the latest one.
  3. If you are filtering emails that are coming with your domain, there can be some issues where the filter is not recognizing it (for example if my email is the domain will recognize me as Srdjan Suc and it will fail with the filter)

Email addresses do not show in the mail subject.

Instead of using the filter option in the GetMailMessage activity, I just got the list as it was, then iterated the list searching after the filter I want in an If Statement.
For each in list (
If currentMail.subject = str_subject

Performed way better (100% hit rate) and worked a lot faster than the UiPath activity with the filter option chosen.

The activity itself is broken and unstable, tried with the latest version and the 5 latest versions so it is not just the old versions.