Issue regarding Mail Attachment Downloads

Hi all,
I have receive a lot of attachments in one mail with name like:-
Jayesh-Pasport.png , Amit-Passport.png , Jayesh-DrivingLicense.png , Amit-DrivingLicense.png

So from that I want to download only Jayesh-Passport.png and Amit-Passport.jpg files. In short I want to download the files which contains the Passport.

Please give a suggestions.
@ClaytonM @palindrome

1 Like

Hi.

Here is the simple way:

Save Attachments activity to a temp folder, and use Output property to store the enumerable of filenames
Loop through each of the filenames in the enumerable using ForEach activity
Move File activity only the files that meet your condition, and delete the others

tadaa!

The more efficient and technical way would be filtering the Attachments in the mailmessage prior, then using Invoke Methods to save the attachment. Here is a screenshot to show a little example:

It assigns a filtered list using .Where() by a condition(s), then creates a filestream to place the attachments into using CopyTo method, then just disposes the stream. I can explain it in more detail (especially how it is getting the attachments to a list) if you want, but let me know.

Regards.

1 Like

Hi,

Thanks for your Response.

I will try and let you know.