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.

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”


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