Get the path of an attachment

I have a process in which I need to extract the full path of an attachment obtained from an email that has been saved in a folder.

When I use the Save attachment activity, it saves it in a variable of type IEnumerable
How can I obtain from this variable the full path where the file was saved?

Thank you

Hi @Marisa_Ontiveros1

You are using the Save attachments activity right, then you have to Specify the folder path in the folder path field in properties.

The attachments in the mail will be saved in the given folder path. Then you can easily access those files.

Check the below image to where you can specify the folder path,
image

No need to create any variable to the output of Save Attachments activity.

Hope it helps!!

@Marisa_Ontiveros1,

You can use For Each and pass the IEnumerable. This will give you all attachment paths.

Thanks,
Ashok :slight_smile:

You can loop over the IEnumerable as mentioned by others above

Checking: if Attachments are present
myIEVar.Any()

Accessing by Index
myIEVar.ElementAt(0) - e.g. the first

Converting into a string array
myIEVar.ToArray

FlatString creation
String.Join(" | ", myIEVar)

I can’t use a for each, because I already have it inside a for each email and I need to upload the file path one by one to the orchestrator queue. Is there a way to extract the path from the IEnumerable type variable?

Thank you for your help

@Marisa_Ontiveros1,

Why not. You can use another for each.

Output:

Sample code:
GetAttachments.xaml (11.7 KB)

Thanks,
Ashok :slight_smile:

Because for each of the emails, each attachment is saved in a folder. And I need to upload to the queue the path of each of the attachments and the sender, the email address of the person who sent it.

I need to upload in each queue item the full path of the file and the email address of the person who sent it.

That’s why I’m looking if there is any way to extract the path of the attachment that is in the output of the save attachment activity, which is of type IEnumerable

@Marisa_Ontiveros1,

This is highlighted logged code will give you attachment path.

outputVariable.ElementAt(0).ToString

You can use it to add to the queue.

Output:

Thanks,
Ashok :slight_smile:

1 Like

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