Save multiple attachments from multiple emails to local folder with date from outlook

Hi All,

I am trying to Save multiple attachments from multiple emails to local folder with date from outlook. Please help

Hi @Sudheer_Kumar_S !

First of all you have to know the date of the message:

Asssign
mailDate(String) = mailMessage.Headers(“Date”)

Then you use activity - Save Attachments
Then you use for ach activity as:

For each attachment in mailMessage.Attachments with typeArgument “System.Net.Mail.Attachment”

In body of for each you will have:

Assign
originalAttachmentName = Path.GetFileName(attachment.Name)

Assing
newAttachmentName = mailDate + “_” + originalAttachmentName

Move file
from: Path.Combine(path from activity saves attachment).ToString, originalAttachmentName

to: Path.Combine(path from activity saves attachment).ToString, newAttachmentName
(That will rename you attachment and add the date)

The activity save attachment cant save attachment with different name.

Thanks for your reply but it is not taking as
mailDate(String) = mailMessage.Headers(“Date”)

please provide example flow if possible thanks in adavance

Hello @Sudheer_Kumar_S ,

Probably you took whole list of messages (output of get mail message) and thats reason why it didnt work. First you have to take only message throug the for each :slight_smile:.

There is you example:


Hope, that will help you :slight_smile:

1 Like

thanks it worked :slight_smile: @doceluch

1 Like

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