Send file to user

Hi,

Could someone help me with the following:

Robot needs to read the names of the excel files and send it invidually to those names. Could somebody help me with that?

image

For example the for the first file it needs to read the file name attach it to a email and send it to that name.

If someone could help me that would be much appriciated!!

Kind Regards,

2 Likes

Hi @ukjtenhoven

Kindly follow the below steps that could help you solve this issue
–use a assign activity like this
out_filepath_array = Directory.Getfiles(“yourfolderpath”,"*.xlsx")
–then use a for each loop and pass the above variable as input and change the type argument as string in for each loop
–inside the for each loop use a send outlook or any send mail activity and in the attach file property mention as item (the variable from for each loop which will have the path)
–and to use only thee file name of the file in the body or mail subject
we can get the filename like this
out_filename = Path.GetFileName(item)

Thats all buddy you are done
Kindly try this and let know for any queries or clarificatiON
Cheers @ukjtenhoven

Hi,

Thank you so much for the quick reply!! I made the sequence like this:

But it gives me a error saying:

image

Could you help me with that?

Cheers, @Palaniyappan

well you were almost right
but the thing you have mentioned the filename as Mail recipient that is as receiver mail id
is that write…buddy
and one more thing dont get the file name if you are trying to send each file name with each mail, It should be inside the for each loop like this
For each loop
–assign activity like this
out_filename = Path.GetFileName(item)
then
–send outlook mail activity
make sure that the receiver mail id correct and use that out_filename variable in TO property if it has the mail id in its filename or mention it any where as a string either in subject or in body

Cheers @ukjtenhoven

Wait I am a bit confused sorry. So I need to change the: out_filename to out_filepath_array?

Cheers, @Palaniyappan

2 Likes

No worries
buddy
the sequence should be in this order
–assign activity
out_Filepath_array = Directory.Getfiles(“yourfolderpath”,"*.xlsx’)
–then for each loop and pass the above variable as input out_Filepath_array
and the change the type argument in for each loop as string
inside the for each loop
–use a assign activity like this
out_filename = Path.GetFileName(item)
–use a send mail activity
make sure that the receiver mail id correct and use that out_filename variable in TO property if it has the mail id in its filename or mention it any where as a string either in subject or in body

Cheers @ukjtenhoven

Thanks again right now I am getting this error:

Do you now why?

Cheers, @Palaniyappan

get the cursor to that blue mark buddy
would like to see the error message
Cheers @ukjtenhoven

Nevermind I fixed the error but I still keep getting this error:

image

Does it have to do with this:

image

Cheers, @Palaniyappan

Fine
Buddy i already mentioned the error is due to that the Filename has email id or not
because in TO property we are passing Filename as input, does that has any emailid as file name
we need to pass only the email id in the TO property of send mail activity
Cheers @ukjtenhoven

Im so confused is it possible that I can upload the file?

Cheers, @Palaniyappan

No worries
yah sure kindly send both the excel file and xaml file , project.json file all together in a zipped folder
Cheers @ukjtenhoven

Reports.zip (7.2 KB)

Thank you very much!

Cheers, @Palaniyappan

Is something missing or is it good?

Cheers, @Palaniyappan

1 Like

i saw the workflow
yah its correct
writeline should give you the filename if you run
but change the type argument in for each loop as string in property panel
Cheers @ukjtenhoven

Hi,

Thanks for checking but when I use a Write line with out_filename is returns empty.

image

Cheers, @Palaniyappan

there is no recods in the excel attached buddy
Check with that once
Cheers @ukjtenhoven

Yes I know it needs use the name of the file for the TO

So it uses the file name as the receiver. I’m sorry if I was not clear.

Cheers, @Palaniyappan

Ah sorry no need to worry about content in the file
we need only file name right
No worries
make sure that the folder Reports has files and file names with extension .xlsx
Cheers @ukjtenhoven

yep look:

image

Write line still returns empty

Cheers, @Palaniyappan

1 Like