Array/List gives error in SMTP Send Mail Attachment Field

So basically i am trying to send multiple attachment at once using the SMTP Send Mail.

Just for a note i am using 2.1.20 UiPath.Mail.Activities

So i checked with both List and Array with assign activity
AttachmentList = new List(Of String)
AttachmentArray = Directory.GetFiles(FolderPath)

Data type is attached

Whenever i input the attachments field it gave me an error
“Argument ‘ResourceAttachments’: BC36754: ‘String()’ cannot be converted to ‘IEnumerable(Of IResource)’ because ‘String’ is not derived from ‘IResource’, as required for the ‘Out’ generic parameter ‘T’ in ‘Interface IEnumerable(Of Out T)’. The selected value is incompatible with the property type.”

the same is happening with List
“Argument ‘ResourceAttachments’: BC36754: ‘List(Of String)’ cannot be converted to ‘IEnumerable(Of IResource)’ because ‘String’ is not derived from ‘IResource’, as required for the ‘Out’ generic parameter ‘T’ in ‘Interface IEnumerable(Of Out T)’. The selected value is incompatible with the property type.”

HI,

Can you try the following expression?

arrAttachments.Select(Function(s) LocalResource.FromPath(s))

OR

arrAttachments.Select(Function(s) LocalResource.FromPath(s)).ToArray()

Regards,

HI @David_Jansen

Just Pass the variable File path Attachment collection after clicking file path

and it will work

Hope this helps!

1 Like

Hi @Sanjay_Bhat & @Yoichi

I ended up using sanjay advice as i do not know that the attachment got some hidden compartment in it.

Thanks

1 Like

Hi @David_Jansen

Please do mark as a solution if it helps You!

Happy Automation :innocent:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.