Attach multiple files to send outlook messages


#1

In a list i have the paths of all the files to be attached but I dont know how to attach all of those files to the same email.


Send outook mail message - multiple attachments
Checking For Files Inside Local Machine Directory
Subject and body text when adding multiple attachments
#2

Updated @renjith_krishnan

List --> dynamicattachments.xaml (9.4 KB)

Array --> outlookdynamic-2.xaml (8.9 KB)


Sending a Excel Chart via Outlook
#3

Sry that i didnt mention i have the list of paths as an array. And array cannot be passed on to invoke method as an object @vvaidya


#4

Try a bit harder, you will figure it out.

you need to remove inner for each in the code I sent.


#5

We can iterate on list using for each, and read one by one file path and add to a string variable using comma. This can be passed to send mail activities’ attachments part. Mail will be sent with multiple attachments.


#6

I have not tried this, but this seems to be simpler solution if it works… I used Mailmessage attachments in Invoke Method which is an additional step.

string.join(",",arrayPath) should be passed into attachments


#7

Hi @suripaleru, quick question - I tried your approach, but keep getting a File Not Found exception when joining all the file paths together.

Aside from the comma, did you use any other characters to separate the individual file paths?

I’ve got @vvaidya’s approach working, but still curious to see if this alternate approach can work too.

Thanks in advance :slight_smile:

@LP_Cigen


#9

@simadri

That not checked but should work i guess. :slight_smile:
but still can i see what you are passing? and what you are not getting? @simadri?

you can check the other thread as well and update here that you are still facing that prob or not.

Regards…!!
Aksh


#11

Hey @simadri

Yes you can do like this way just read the files from a particular directory and use for each on the file array then pass that to to add that item in Mail.Attachments collection in invoke method.
In the example thread link you have to change your directory path from where you want to read all files inside that folder

and you are getting that error because your file path is not correct.
Regards…!!
Aksh


#12

@aksh1yadav Thank you for the suggestion … can you send me a sample xaml file ??? And the path name / file name is correct though .

Thanks in advance…

Regards,
Simadri


#13

you can share yours files and sample xaml i will look into that :slight_smile:


#15

How To Solve This Issues ?


#16

Hey @kirtiSagar

use

MailMessage mailId = New MailMessage

Regards…!!
Aksh


#17

Still Getting the Same Error !!!

mailId is a variable with Microsoft.Office.Interop.Word.MailMessage Variable Type ?


#18

no it should be System.Net.Mail.MailMessage


#19

Still Same Error
I ll Share WorkFlow With You ?HRonboarding.xaml (42.9 KB)


#20

HRonboarding.xaml (43.0 KB)

Use this. there was namespace collision so you can use like System.Net.Mail.MailMessage.

MailMessage mailId = New System.Net.Mail.MailMessage


#22

Hello Akash,

I just tried Inovke method from your Workflow, I’m Getting an error in method name

I dont know How to rectify this please Help Me

Ganesh


#23

Gracias, me fue muy Ăştil. :relieved::cowboy_hat_face::muscle:


#24

Hey @Rony_Janampa

Gracias :slight_smile:

Regards…!!
Aksh