What is the Correct Format of writing Filter Expression in Get IMAP Mail Messages Activity?

Hi,

Could someone please help me with the correct format value to be entered in the FilterExpression Property of Get IMAP Email Messages Activity (yellow highlighted in below snapshot)

image

I was trying to apply a filter like : "SUBJECT " (Please ignore angular brackets as part of filter expression) to filter the mails which contains in the Subject, as per the Uipath Official Documentation as below:

But My Bot is failing with below error Message :
Get IMAP Mail Messages: The IMAP server replied to the ‘SEARCH’ command with a ‘BAD’ response: The specified message set is invalid.

Any help would be really appreciated !!

Regards
Sandeep Negi

Hi @sandy.randy95

For Get IMAP Mail Message Activity, we don’t have any option. But you can use Get Outlook MailMessage Activity to do this and it has direct option like Filter. By using this, we can filter our mails based on subject, body and sender etc…

If you want to work with Outlook application it should be installed in our machine and also it should be in online.

Hi Gokul,

Thank you for your Response !
I believe we have this option available in Get IMAP Mail Message Activity, PFB the Screenshot for your reference(yellow highlighted). I am using Uipath 2021.4.4 Community Edition.

Also, I don’t have any specific requirement, I was just exploring all the Email Activities and came across this one. I wanted to understand how this property works and its significance and how to enter filter expressions in this property. By following Uipath Official Documents(to enter Filter expressions), it is giving me below error:

Get IMAP Mail Messages: The IMAP server replied to the ‘SEARCH’ command with a ‘BAD’ response: The specified message set is invalid.

I hope you have understood my query !

Regards
Sandeep Negi

Hi @sandy.randy95

I think so this sample expression will help you
Try below steps:

  1. Get IMAP Mail Message activity will give output as list of mail messages and say ‘mailMessages’.
  2. Then use below expression to apply filter based on subject of the mails.

mailMessages = mailMessages.AsEnumerable().Where(Function(x) x.Subject.ToString.Equals(“requiredSubject”)).ToList