Im having some problem attaching .xlsx files from a folder to “Send Outlook Mail” activity.
There are 5 .xlsx files that i want to attach, but i cant get it working?
I also want to do the same but with a dynamic number of files?
Hope someone can help me with how this can de done.
Are you getting any error message? I hope you are using attachfiles property and passing file variable into path column in send outlook email activity.
To pass dynamic files , you can create a mailmessage object and attach files to it and pass that object in your send outlook email activity.
Someone provided sample in the past, please search the forum.
hi aksh1yadav i m unable to open your project on my ui path.
The issue i am facing is i can attach one or more files when i use the hardcoded path but how can i make it send all the files that exist in an a folder
?
What version of UiPath Studio you are using?
Well mine was 2016.2.6274.
You can Get all files from Directory by using System.IO.Directory.GetFiles("Attachments") or Directory.GetFiles("Attachments")(If System.IO Namespace is already imported).
Basic Flow:
1. String[ ] fileNames_to_be_attache= Directory.GetFiles("Attachments") 2. System.Net.Mail.Message mail = new MailMessage() 3. For Each with type argument String.
foreach item in fileNames_to_be_attache{
System.Net.Mail.Attachement attachment = new Attachment(item,System.Net.Mime.MediaTypeNames.Application.Octet)
Invoke method -activity
type - (null)
TargetObject - mail.Attachments
MethodName - Add
}
parameter for invoke method-
Hi @aksh1yadav I am using your attach and send mail for outlook and i am able to snd mail but attachments are not getting attached to mail and i have bverified the path in write line it is showing the two file names properly ?
I used ur project u had shared earlier, i worked.
But is it possible to take the latest file that arrived in that particular directory and attach the same into the mail.