Get the Filename from Attachments

Hello all,
I need the complete name of a .csv that is attached to an email. In the activity Save Attachments I have set a filter on the .csv, which works, but I cannot get the name.

The name is in (8) but this is different and can also be a different index.

How do I get the file name after Save Attachments? in_MailMessages(in_int_Mailcount).Attachments(8).Name

HI @NHoe

If your email contains just one attachment you could use the following code to get its name:

attachmentName = CType(item.Attachments.FirstOrDefault, Attachment).Name

Regards
Gokul

Hi @Gokul001 this Mails have a lot of diffent attachment, but i need only the Name from the csv

Hi @NHoe,

I create a small sequence for you.

There is the screenshot and the process document. Kindly check it and if there is a problem i can help you. You can also add break activity after assign.

ReadMail.zip (225.6 KB)

Kind Regards

Hi, I didn’t really want an extra loop to get the name out, as I have already set the filter on the csv in the Save Attachments activity. The mail itself always has only one csv. It must be possible to get the index of the csv from the Save Attachment.