Save attachment that file name ends with SES.xls?

Save attachment that file name ends with SES.xls

Example :
I have file attachment in mail 2 file Report_01.09.2021_ENR.xls and Report_1232_SES.xls

I want to save file Report_1232_SES.xls only to folder computer.

Please guide me about it.

1 Like

Hi @Maria99 ,

You can check with “contains”

yourstring.contains(“SES”) or check with split for the last string yourstring.Split("_"c).Last

Hi @Maria99

Use Filter condition from the Properties save attachments.



Hope these steps would help you resolve this

—first let’s get the output from get mail activity and save it to a variable named emailist

—and use a FOR EACH activity and pass the above variable as input and change the type argument as System.Net.Mail.Mailmessage and inside the loop use again a for each activity with type argument as System.Net.Mail.Attachment


Once you get the name
Inside the same loop use a IF condition and mention this condition

If true it will get that attachment save it using SAVE ATTACHMENT ACTIVITY

or to get the attachment name directly use this expression in a assign activity with the following steps

—get the output from get mail activity
—use a for each loop with type argument as
—inside the loop use a assign activity like this

attachmentName = CType(item.Attachments.FirstOrDefault, Attachment).Name

Kindly check it at the example below:
Main.xaml (1.2 KB)

Pls let know for any queries or clarification

Cheers @Maria99

1 Like

@Palaniyappan File that your attached after download it show blank flow.

1 Like

No worries
It’s the same steps as I mentioned in words
Pls try with the same it will work for sure


@Palaniyappan right?

1 Like

Try with these
We can even make the filter with SAVE ATTACHMENT activity itself
Where you can mention the expression in filter property of save attachment activity
Like this in filter property

@Palaniyappan I don’t found name in items

Change the type argument of for each of attachments


1 Like

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