Hi guys,
i have one folder path is C:\Rpa Files\Temp.
i need to send outlook email with attachements all the file from above folder if possible pls send me a workflow screenshot its help full for me.
Hi guys,
i have one folder path is C:\Rpa Files\Temp.
i need to send outlook email with attachements all the file from above folder if possible pls send me a workflow screenshot its help full for me.
Hi @MD_Farhan1 ,
You can try these steps:
Use Assign activity:
filesArray = Directory.GetFiles(“C:\Rpa Files\Temp”)
In the Send Outlook 365 Email activity, set Attachment(s) to:
filesArray
Or directly:
Directory.GetFiles(“C:\Rpa Files\Temp”)
Workflow (Simple):
Assign
filesArray = Directory.GetFiles("C:\Rpa Files\Temp")
Send Outlook 365 Email
To = "user@company.com"
Subject = "Files from Temp Folder"
Body = "Please find attached files."
Attachment(s)= filesArray
Alternative: If you need to filter specific files (for example only PDFs):
Directory.GetFiles(“C:\Rpa Files\Temp”,“*.pdf”)
Thanks
what datatype of filesArray?
You can use String filesArray.
Create variable filesArray
String[]Pass filesArray into Send Outlook 365 Email → Attachment(s).
The error is because the Microsoft Outlook 365 Send Email activity expects IEnumerable<IResource>, not a String[] of file paths.
Use Create File Resource activity inside a For Each loop:
fileArray = System.IO.Directory.GetFiles(“C:\Rpa Files\Temp”)
Workflow:
Assign:
fileArray = System.IO.Directory.GetFiles(“C:\Rpa Files\Temp”)
Create variable:
attachmentsList
Type: List(Of UiPath.MicrosoftOffice365.Models.IMailResource)
For Each file in fileArray
filefileResourcefileResource to attachmentsListIn Send Outlook 365 Email → Attachment(s):
attachmentsList
Hi,
This is changing file format but i need all file from folder to email attachments.
still got error better make a workflow then screenshot easy to understand
Hi @MD_Farhan1,
Use the below expression:
System.IO.Directory.GetFiles(“C:\Rpa Files\Temp”).Select(Function(f) LocalResource.FromPath(f)) .ToArray()
If this solves your issue, please mark the answer as the solution.
Thanks!
Please follow the below steps,
take assign activity, create a variable (arrFiles) variable Type = Array of string(String)
In Send Email Activity, open attachment section and pass the below expression,
arrFiles.Select(Function(path) LocalResource.FromPath(path)).ToList()
This is i tested and it worked.
Let me know if this works for you as well
If works please mark it as solution.
Happy Automation
Welcome to the community
There are two ways
{LocalResource.FromPath("C:\Users\A\Downloads\file.format")}