How to number Outlook email file name?

Hi all,

I have created a sequence which saves unread emails by their dates received. I am trying to save it by this format:

  1. create today’s folder by grabbing the date from the email:
    e.g. c:\temp\20180208

  2. create a folder in numerical order e.g.‘1, 2, 3’ in c:\temp\20180208\ for each email:
    e.g. c:\temp\20180208\01\1_email_20180208.eml
    e.g. c:\temp\20180208\02\1_email_20180208.eml
    e.g. c:\temp\20180208\02\2_attachment.eml
    e.g. c:\temp\20180208\03\1_email_20180208.eml

  3. And the email that was received in other days would be like:
    e.g. c:\temp\20180210\01\1_email_20180210.eml
    e.g. c:\temp\20180210\02\1_email_20180210.eml

May i know how i could go about doing this, as i am having trouble reseting the counter for every mail in each folder? Any guidance would be appreciated as I’m still new to this.

This is my current sequence:
v5 - UiPath.xaml (11.5 KB)

The count goes in running order and not ‘1’, ‘2’ instead for the different dates:


Thank you! :slight_smile:

1 Like


Refer this,

Note: We have list of solutions given before in that link

Dominic :slight_smile:

Hi Dominic,

I have actually saw that post before i posted my own query, but what I am looking at doing is something a bit different from that post.

So I would like to seek some help on understanding it!

1 Like

Hi @testuser,

i have modified few thing from your code.
please check and let me know.

v5 - UiPath.xaml (12.6 KB)



Hi arivu96,

Thanks for your help and apologies for the late reply! :slightly_frowning_face:

It’s what i am looking for! But except, i do not understand how come some emails have two emails saved to a folder? Have tried troubleshooting but i could not seem to understand what went wrong

Hi @testuser,

May be the same date received 2 mail that’s y saved in the one folder.

Can u check.


Hi Arivu,

Thanks for the prompt reply. I have checked. There weren’t exactly any similarities between the four mails except that it was all sent within the same day, but they were split into 2 folders with 2 mails in each. Weird :joy:

Hi @testuser

I did a bit modify based on your code, check if it fits your need Main.xaml (11.3 KB)

1 Like

Hi Windell,

Thank you so much! This is exactly what i am looking for, it works perfectly!!! :crazy_face:

You are so welcome:sunglasses:

1 Like