How to rename the attachment file after downloading from outlook.?

how to rename the attachment file as “FileName” + “_” + after downloading from outlook.??

i am saving this attachment file in my local folder and i am maintaining the path of folder at Config.xml.


Can someone help Neha if you have time.Thanks. @certified

1 Like

We are on a call right now lol

1 Like

You can loop through the attachments of email and then use attachment ContentStream method to save the attachment using different name. see this link

We used Stream Clase XAML provided by @andrzej.kniola How to save perticular file from outlook, when the attachments contains multiple files

I was unable to find the original post… but thanks perhaps you can share the XAML @NehaGhodki


1 Like


Here is the same approach that @andrzej.kniola but extracted as a reusable component and expecting attachment object as input.


  • StrDestinationDirectory : The directory where the attachement will be save (ex: “C:\Temp”)

  • MailAttachment: The System.Net.Mail.Attachment that you will get from AttachmentCollection of a Mail object.

  • StrFileName(Optional) : The name (with extension) under what the attachement will be saved. If ommited, will be named after the initial attachment file name.

.Outlook_SaveAttachment.xaml (8.1 KB)