How to Create a Queue Item with Multiple Attachment File Paths in UiPath

Hi everyone,

I have a UiPath workflow where I download a .eml file and save its attachments. The business requirement has changed, and now I need to handle multiple attachments instead of a single one. The SavedAttachments variable, which holds the paths of the attachments, is of type System.Collections.Generic.IEnumerable<System.String>.

Previously, I was extracting the first attachment’s path using SavedAttachments(0) and creating a queue item with this single file path.

Now, I need to enhance the workflow to create a single queue item that includes all attachment file paths (there could be up to 5 attachments). I’m thinking of using JSON serialization to handle this, but I’m not sure how to proceed.

Could someone guide me on how to: handle that new case of multiple atachments.

the attachments can be either 1.
the attachments can either be 2,3,4,5 any thing

Hi @Avyan.Sharma

Please check this

Regards,

1 Like

Hi @lrtetala

thanks for the reply , but i not able to understand the query, in for each i am iterating a list correct ?

please tell me
what comes at item.Attachments ?? because UiPath is not allowing me to select:

as my varialbe type is: System.Collections.Generic.IEnumerable<System.String> .

@Avyan.Sharma,

In assign activity use below code:

strAllAttachments=String.Join(";", item.Attachments)

This will give you all attachments in single variable separated by ; charachter. Directly pass this variable to Add queue item so it will get added into Queue.

Don’t need of this logic anymore.

While retrieving the attachments from queue use below code in assign activity:

arrayOfAttachments=in_TransactionItem.SpecificContent("Attachmentkeyname").ToString.Split(";")

Thanks,
Ashok :slight_smile:

Hi @ashokkarale

thanks for the reply, but when i am try to get it in a for loop with object type as
System.Collections.Generic.IEnumerable<System.String> .

the error comes is : attachments is not a part of this datatype.

@Avyan.Sharma,

If you are trying to iterate all the attachments of the mail, your argument type should be System.Net.Mail.Attachment

Thanks,
Ashok :slight_smile:

1 Like

hi @ashokkarale
appreciate for the replu

image

i am still confused how are you concating the attachments string from the email object
are we iterating the email object and then using you condition (because it doesnt work)

or we are not iterating ?? then how doe we get attachments stored in a string ??

please help

thanks

@Avyan.Sharma,

You don’t need to iterate really. See here. I’m using Get Outlook Mail’s for reference. Yours could be different source like .eml file as you mentioned.

After that I’m Saving the Attachments using Save Attachments activity which will give me a IEnum

We are just using String.Join to join this IEnum into a single string using this assign:

strAttachments = String.Join(";",lstAttachments)

Sample:

Code:
Attachment Demo.xaml (9.3 KB)

Hope this is more understandable and helpful now!

Thanks,
Ashok :slight_smile:

1 Like

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