I want to keep the time of received mail in Outlook and keep the data in Excel, what should I do?

How should I be able to store the date and time the email was received? and save the data in a table in Excel.

1 Like

You can use mailMessage.Date to get date of the mail recieived
E.g:-

  1. mailMessages.Select(Function(recieved) recieved.DateAsDateTime.ToString("dd/MM/yyyy")).ToArray

  2. mailMessages.Select(Function(recieved) recieved.Date.ToString).ToArray

These to give an array of dates of the mail recieved, then loop through the array and add to datatable using add data row Activity

3 Likes

Hi @Famui_Yanisa ,
You can extract the date from the email as a DateTime variable type with EmailReceiveTime = CDate(mail.Headers(“Date”)), and then simply covert that received date into the time format you need, like this: EmailTime = TimeEmailReceived.ToString(“HH:mm”) …
Then add 1 columns "Time received "in Excel to write

my output

my step:
-create file to save mail and time
-get list mail
-for each mail to get body and time
-write cell to write value of body and time to excel file


I sent xaml file and ouput file, you can try it
Hope it help
Regards,
LNV

3 Likes

Hi @Famui_Yanisa

You can use mailMessagevariable. receiveddate to get the date of the mail received.

2 Likes

@Famui_Yanisa

Say the output of get mail is mailsout …then you can loop through the variable using for loop to get each mail

Then currentitem.Date will give you the datetime of mail and this can be added to datatable using add datarow and after loop write the data back to excel

Cheers

1 Like

Hi @Famui_Yanisa

You can use the below syntax to get the Date and time of Each Mail.
In For each Mail activity take an assign activity, CurrentMail.Headers(“Date”)

Hope it helps!!

2 Likes

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