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?
image

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

Vasile.

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

“[subject]=‘Merchant’”

“Subject eq Merchant”

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

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

“@SQL=”“http://schemas.microsoft.com/mapi/proptag/0x0037001”" 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.

Regards,
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.

2 Likes

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”


“subject:Merchant AND from:""xyz@email.com”""

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?

@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 https://docs.uipath.com/activities/docs/get-exchange-mail-messages 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 Docs

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

Hi!
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.