I need to extract names of 2 attachement files in a mail but without extension

Hi Team,

I need to extract names of 2 attachement files in a mail but without extension, only the names

I tried this but i have this issue :

String.Join(", ", currentMailMessage.Attachments(0).Select(Function(x) x.Name))

The image shows an error in the Expression Editor of UiPath, indicating that 'Select' is not a member of 'Attachment' while attempting to process an expression to join attachment names. (Captioned by AI)

Hi @Soudios

Try this

String.Join(", ", currentMailMessage.Attachments.Select(Function(attachment) System.IO.Path.GetFileNameWithoutExtension(attachment.Name)).ToArray())

Regards,

1 Like

@lrtetala

i need this code for 2 attachements,

attachment 1 : ?
attachment 2 : ?

tks

@Soudios

attachment1Name = System.IO.Path.GetFileNameWithoutExtension(currentMailMessage.Attachments(0).Name)
attachment2Name = System.IO.Path.GetFileNameWithoutExtension(currentMailMessage.Attachments(1).Name)

Regards,

1 Like

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