Outlook mail saving to local folder

Hey Hiii everyone
I want to download top 5 unread mails from my outlook inbox folder and save it in local folder… While saving in local folder it has to create new files and should get save there (dynamically create n save files)…I’m not getting how to give path(dynamically) …Pls help me out

1 Like

Hi buddy @DEEPAK_K.S

Welcome to uipath community buddy…

  1. use get outlook mail activity to get the list of mailmessage of outlook and get the output variable like out_mail_message of type list
  2. here in this activity you have to set properties as checked like onlyunreadmessages property and markasread property and Top property as 5
  3. now use a for each loop to iterate through the list of mails we obtained
  4. pass the variable out_mail_message to for each loop and change the type argument property of for each loop as mailmessage
  5. inside the for each loop use a activity called save attachment activity with inputs as item from for each loop and the folder where to save the file buddy,
    where item is the mailmessage in list of mailmessages of variable out_mail_message and even one mail has four file attached they will be create as new files buddy with their name…

Thats all you are done buddy
Kindly let know whether this works or not buddy
Cheers @DEEPAK_K.S

Did that work for you buddy @DEEPAK_K.S

I have tried it but all the mails r getting saved in One file only… ( one is getting replaced by another)

I want to download the mails… Not the attachments of mails
Path given
Ex: desktop/outlook/mail1.msg

All five mails r stored in mail 1 only replaced by each other…

I want it to be stored as mail 1, mail 2 …mail5

1 Like

Noooooo can u help me out
I want to download mails not their attachments

1 Like

Got it buddy
Sorry for misunderstanding the query @DEEPAK_K.S
here you go
once you get the for each loop with mailmessage list passed as input,
IN save attachment activity,
set the path like this buddy
“C:\Users\xyz\Documents\UiPath\forum_2\Mails\Mymail”+"_"+item.from.address+".eml"

where
C:\Users\xyz\Documents\UiPath\forum_2\Mails\ ----is the folder
Mymail — the first part of file name
item.from.address ---- person from whom weget the message buddy
and it worked buddy


image
This would save the mail in dynamic name @DEEPAK_K.S
Cheers
Kindly try and let know buddy whether this works or not

Did that work buddy @DEEPAK_K.S

Noooo! It’s not I have two mails which I want to download it read two mails…and while downloading… It stored two mails in One file only( second mail is replacing the first one)…i can see only one file after executing the program…

I did the same thing what I said

Help me out

1 Like

Buddy may i have a view on you xaml buddy @DEEPAK_K.S
Actually it worked for me buddy
did you try this buddy

or
kindly send with project.json file as well in a zipped folder buddy
its almost done
Cheers

Is it possible to download attachment from the email that after I’ve saved an email message in a local folder?

@Aakanksha_Pathak hi aakanksha , Did u get a solution to save attachment seperatly after saving as .msg file in local folder, if so please share the solution.

Thanks in advance

Regards
Divya

use save attachments activity.

can u please share the code or the variable type that is to be assinged because without get outlook mail message activity the save attachment is not working if a set of mail message files opend from folder

@Palaniyappan, if i want to filter the unread messages by subject line(EX:in subject like a keyword contains Payment,) then what should i mention in Filter in Properties.