Convert IEnum to array

Hi,

I do “Save PDF Attachements” and get IEnum_AttachmentNames variable.

Later I want to join all attachments into one PDF with “Join PDF” activity
which needs an array as input.

So I am “converting” IEnum_AttachmentNames in array_AttachmentNames in:

Is this OK or is there another /better way to do it?

Thx for any suggestions.
KR, Vanja

1 Like

@VanjaV,

Instead of using for each, use this LINQ in assign activity for this.

attachmentNamesArray = savedAttachments.Select(Function(filePath) Path.GetFileName(filePath)).ToArray()

1 Like

This is great. Is it also possible to get array in order as they were saved to filePath?
Because first there is always Invoice in attachments and later additional documentation.

KR, Vanja

@VanjaV,

The Save Attachments activity already outputs the file paths in the same order as the attachments were saved. When using LINQ to extract the file names, this order is preserved unless explicitly changed.

1 Like

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