How to use AttachmentsCollection in Send Outlook Email

Hi all,

I am trying to send a few files within an array. This array ‘email_Files’ is the variable I use to store the paths for the respective files I need to send, however, when I run the process, it will say the file cannot be found. How would I go about solving this issue?


Can you share how you got content of email_Files variable?


Hi there,

In short, I get the files I need using Directory.GetFiles. Afterwards I would String,Concat the files into a one big string named attachment_Files. Finally I would assign email_Files to Split(attachment_Files).


@SRoyi make a list type variable and feed all paths of file in that list and pass to collections.


For now, can you try to set Breakpoint at the SendOutlookMessage activity, then debug run?
Workflow will stop at SendOutlookMailMessage and check if content of email_file is what you expect in Locals panel. If it’s not what you expect, please review your logic.(GetFiles or Split etc)


Hello, that is my current method however it still does not work,

Firstly once I get all my files that I need, I will feed it into a String variable attachment_Files.

Afterwards, I will assign it to an array string variable email_Files = Split(attachment_Files, “,”).

Lastly, when I put email_Files into my attachmentCollections the files cant be found

@SRoyi I believe it should be string and I have tried with list and its working

Why are you converting a collection of strings, into a string, and then back to a collection?

I used Directory.GetFiles to get 3 files since the naming is different. Then I joined these 3 file paths into 1 collection of string attachment_Files. But when I try to put it into attachmentCollections, the error message will say String cannot be converted to System.Collection.IEnumerable (of string)

To me, that conversion step seems extra. You can set the result of Directory.GetFiles to the attachmentCollection.

My method was to use 3 seperate Directory.GetFiles, since the get criteria was different. Tha is why I had to String.Concat it into attachement_Files.

Don’t use String.Concat, but Linq concat instead. Say, if you have 3 variables that contain array of files (strings): filesA, filesB, filesC. Then to concat:

resultFiles = filesA.Concat(filesB).Concat(filesC)

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