Ending Multiple Attachments Using Array in UiPath Exchange Mail Activity

I am trying to send multiple attachments using the Send Exchange Mail Message activity in UiPath. However, I am unsure whether I can use an array (arr) to pass the attachment paths.

I would like to know if it’s possible to send multiple attachments by using an array, and if so, how I should configure it correctly in the Send Exchange Mail Message activity.

For example, if I define an array like this:

vb

Copy code

attachmentsArray = {"C:\path\to\file1.txt", "C:\path\to\file2.pdf", "C:\path\to\file3.jpg"}

Is it possible to directly pass this array to the Attachments property of the Send Exchange Mail Message activity?

Any guidance or examples would be appreciated.

Thank you!

Hello @Murthy_Chethana

You can use the property AttachmentCollection which supports arrays.
And yes that would be the paths to the files :slight_smile:

Regards
Soren

It doesnt seem to be working though

@Murthy_Chethana

When you say not working…is it throwing error or attachments are not present?

Can you show how you did the setup

Cheers

Hi @Murthy_Chethana ,
Assign
Filescollection(String Array) = Directory.Getfiles(folderpath)
Now in the properties of Send Exchange Mail Message activity
add this variable in AttachmentsCollection.

Happy Automation !!

Hi @parvathi_ayanala ,

This would add the files present inside a folder. But if I want to have attachments from different locations then how can that be achieved?

Thanks,
Babjee Vangipurapu

Are there any limitations for the attachments from different locations ? if yes try this filesFolder1 = Directory.GetFiles(“C:\FolderPath1”)
filesFolder2 = Directory.GetFiles(“D:\FolderPath2”)
filesFolder3 = Directory.GetFiles(“E:\FolderPath3”)

Then you can concat them allFiles = filesFolder1.Concat(filesFolder2).Concat(filesFolder3).ToArray()