Getting email's sent date

Hi,
I am trying to get the date an email was sent in Outlook.
I am able to read the body but I think the date is part of the header.
I tried this: item.Headers(“Date”) but it does not work. I read somewhere this function does not work anymore.

Do you have any idea if there is any way to get this date?

Thanks in advance!

Hello @armi_v
Did you face any errors while using the above expression?
Share some screenshots.

1 Like

There is no error, it just doesn’t return anything, it doesn’t recognize the date in the header I guess.

Hi @armi_v

Try using mail.DateAsDateTime

Cheers

HI @armi_v

Can you share the Header text here? We can use Regex expression to Get the Date

Regards
Gokul

This is the email
I don’t know how could be the logic for Regex to get the date, since it’s going to be always different.

During my testing I also came across one mail that contained an empty header (date). The date is added into the header by the receiving server. It is therefore possible for this property to be null (and thus deliver an empty result in your case).

Likewise, the following would also deliver an empty String:
item.Date.ToString

Is this just one scenario or do you have multiple occurences?

HI @armi_v

Check out the XAML file

GetOutlookMail.xaml (8.6 KB)

image

Regards
Gokul

I have different emails of the same template and I have tried this function with all of them but they all give null as result.

I have used the same logic but to me it returns an empty value

Check the Get Outlook mail properties @armi_v

Check that do you have email in the Inbox

Regards
Gokul

I am constantly marking old emails as unread in order to try this part of the process.
The problem is that the header does not get recognized, if I try to print only the header information it looks like it only has a certain MessageID

Can you share the screenshot or XAMlL file @armi_v

Hi @armi_v

try degrading the mail activities to a lower version if your project is on windows - legacy .

CHeers