Check if email contains BOTH excel and pdf file

Hello,

How do I check whether an mail contains both an excel and pdf file before deciding to save the attachments? I’m only interested in downloading the attachments from the mail, if it contains both.

I’m using the desktop outlook activity to get the mails and then an for each mail with save email attachments activity.

I tried the following but they all return false, no matter which conditions i try:

CurrentMail.attachments.tostring.Contains(“*.pdf”)

CurrentMail.Attachments.Where(Function(attach) attach.Name.ToLower.Contains(“.pdf”)).Count > 0

What exactly am I doing wrong?

Kind regards,

Hello @MaxDS1 ,

You can use the below expression to check if the required file format is present in attachment or not.

in_mailMessage.Attachments.ToList.Exists(function(a) a.Name.Split(“.“c).LastOrDefault.ToString.ToLower.Equals(”.pdf”).ToString))

Thanks,
Rohith

2 Likes

Hi @MaxDS1

Try this solution

GetTheAttachedFromEmail.xaml (19.0 KB)

2 Likes

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