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


#1

how to rename the attachment file as “FileName” + “_” + datetime.today(ddMMyyyyHHmmss) 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.

Thanks,
Neha


#2

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


#3

We are on a call right now lol


#4

You can loop through the attachments of email and then use attachment ContentStream method to save the attachment using different name. see this link https://forum.uipath.com/t/how-to-save-perticular-file-from-outlook-when-the-attachments-contains-multiple-files/921/2


#5

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

regards


#6

Hi,

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

Arguments:

  • 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)

Cheers