I would like to send all files in specific folder as attachments via Send Outlook mail messages.
1 Like
Hi @tomaz
in your send outlook email activity there is a propertie called AttachmentsCollection, create an array of string variable before the send email activity to retrieve all the files you want to send, then pass that list variable the propertie like this
lstInputPath type String[]
System.IO.Directory.GetFiles(yourStringFolderPath)
Regards!
2 Likes
Hi @tomaz,
You can get files as @fernando_zuluaga mentioned.
- In the “Send Outlook Mail Message” activity, set the “Attachments” field to a new list of Attachment objects. For example:
new List(Of System.Net.Mail.Attachment)
- Use a “For Each” activity to loop through each file path in the “fileList” variable.
- Inside the “For Each” loop, use the “Add to Collection” activity to add a new Attachment object to the attachments list for each file path. For example:
attachments.Add(new System.Net.Mail.Attachment(item))
- Once all file paths have been looped through and added to the attachments list, set the “Attachments” field in the “Send Outlook Mail Message” activity to the attachments list.