How to set filter on 'Get Outlook Mail Message' to only process eMails with attachments and Subject containing a certain number of delimiters

I’m trying to figure how to set Filter so only an eMail with an attachment and having a subject that contains three values separated by a common delimiter is processed. I’ve not seen any posts related to filtering on number of attachments in the eMail. Any ideas?

1 Like

Buddy @mwiseman

Welcome to UiPath community buddy… that’s a good question to start with…

Buddy use filter like this in get outlook mail activity
“[Subject]='[value1|value2|value3]”

This will give you the mail only with this subject
Then you can get the output from get outlook mail activity as out_mailmessages in a collection datatype

Pass this to a for each loop and here comes the answer for your question buddy …you can check whether a mail has attachment or not by using a if condition like
Item.Attachments.Any

This will give you a boolean value whether it has attachment or not based on that you can use save attachment activity to save your mail…

Hope this would help you @mwiseman

Chees

is that working buddy @mwiseman

Thanks! Note I need wildcards for ‘value1’ thru ‘value3’ and my delimiter is comma, thus would the filter look like: “[Subject]=’[*,*,*]'” ? Did you leave off a closing single quote in your answer?

@mwiseman
Buddy we cannot use wildcards in subject filter property in get outlook mail message unfortunately, rather you can go for some condition vaildation with if condition

  1. once you get the mail collection from outlook activity with variable out_mailmessage of type list use a for each loop to iterate through each mail message
  2. then use a if condition with subject validation like this
    item.subject.ToString like (“Value”)…well this is far more enough to get that mail with this subject buddy, Followed by you can get the details from that mail with assign activity

Kindly let know for any queries or clarification

Cheers

Sounds like ‘filter’ is very limited if it can only be an exact match and can’t be used with number of attachments. Doing this after retrieving emails will be a performance hit. Thanks for the clarification!

Exactly buddy… @mwiseman