Attach files from folder to Outlook mail

Hi All,

I need the BOT to access folder [2017889900] and inside that there might be files with the extension 2017889900.jpg or 2017889900.jpeg or 2017889900.txt or 2017889900.xlsx .
There might be more than 1 file present.
How can BOT upload all the files present in the folder as an attachment while sending outlook mail?

At the simplest this should work:

Use Directory.GetFiles(“20*.*”) to get a list of files.

Create and attachmentCollection object and then loop through all files and add the full file path to the attachmentCollection. Note that in the Invoke Method, the file path is added as a parameter to the Add MethodName in the properties window.

image

image

In the Send Email Activity, pass the attachmentCollection as a parameter to the attachment collection property

image

image

1 Like

Just use Directory.GetFiles(“folderPath”) in the “AttachmentsCollection” property of “send outlook mail” activity, this way it will attach all the files of that folder path. Hope it helps :slight_smile:

1 Like