Checking if email has certain types of attachments

This is a continuation from a previous post but I need to add an additional filter in the filter option:

Using the “Get Outlook Message”, I need to find emails that contain a particular part of a subject + check if the email has attachments of a particular extensions (e.g. PDF and JPEG).

First part of the filter is: “@SQL=”“urn:schemas:httpmail:subject”" like ‘My subject%’"

I was able to get the first part of the filter but now I need to add the 2nd condition. What should I put in the Filter Option to achieve this requirement?

In addition, is it possible to set the case of the subject in the filter to lower case?

Hi @redanime94,

you can add “hasattachments=true” on your first filter to filter out emails with attachments only. So your filter will look like this:

“@SQL=“urn:schemas:httpmail:subject”” like ‘My Subject%’ AND urn:schemas:httpmail:hasattachment=true"

The filtered emails will then be saved in a MailMessage collection variable. I suggest looping in that collection and then checking the attachment type/extension then do the corresponding actions accordingly.

Hope this helps.

Kind regards,

Thanks @kennbalobalo! It worked! Appreciate the help.

1 Like

Happy to help, @redanime94

Kind regards,

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.