How to get multiple attachment names in Email

Hi all,

I need to get attachment name from Email. However, when there are more than 1 attachment (let’s say 3 attachments), I can only get the very first one .

Can anyone knows how to get all attachment names in one Email.
Currently, I use the following method to get the attachment name.

Hi @mason_wong

If you have an object of MailMessage, you can use below method to get array of its attachment names.
mailMessage.Attachments.Select(function(x) x.Name)

1 Like

Hi wusiyangjia,

I followed your steps but got an error.

Hey @mason_wong

Please try this out and see if it works:
Main.xaml (11.6 KB)

Please let me know if you get stuck :slight_smile:

1 Like

Hi @mason_wong

The return is an array so you need assign it to a IEnumerable variable or immediately for each it or add index after expression in your case like below.
attachementName1 = item.Attachments.Select(function(x) x.Name)(0)
You need not for each your attachments beforehand.