Get date received date from email

I need to get the date an email was received and save it as a variable. I have tried using emailVariable.Headers(“date”) but it is returning no value, just blank. The mail messages are of the type Office365Message.

Does anyone know another way I can get this info?

Probably case sensitive. Use Date not date.

had you tried:
mailVariable.ReceivedDateTime

when working with UiPath.MicrosoftOffice365.Acitivites version 1.11.1 then also
mailVariable.Headers will be empty

When updating to one of the next preview version e.g. 1.13.0-preview Headers is populated

Enabling preview versions we can do:

I meant “Date”

DateReceived does not work, still get null value.

MailVariable.Date says “the email does not specify a date” so it must not be capturing it when it reads…How can I get it?

dicd cross checked and update my post. Please refer to updated version please

I get a compiler error saying ReceivedDateTime is not a member of System.Net.Mail.mailMessage

Office 365Emails will be of Datatype: Office365Message

When you are facing this issue then lets first cleared on what you have implemented so far. Please let us know also which mail relevant package versions you have configured for the project. Thanks

Also kindly note:

I am using the Get Mail activity inside a Microsoft Office 365 Scope. The output is a variable of type Office365Message
I am then looping through each email to extract some info from the body and the date it was received. Here is a screenshot of the packages I have.

ok we do see the 1.11.1 package which was mentioned above with the defect that headers will be empty, just give a try on update to the newest preview version

A construct like:
grafik
will have Office365Message Array as mentioned above:
grafik

Maybe you have to adopt your TypeArgument or you let us know more details on the

I figured it out! My type argument in my for each activity was system.net.mail.mailmessage rather than outlookmessage. Once I changed it I am able to use EmailVariable.ReceivedDateTime

Simple mistake but you helped me see it and I can use your EmailVariable.ReceivedDateTime solution now.

Thank you for your help!

Outlook365Message inherits from MailMessage so both should have the same properties available. It not working is probably due to the bug mentioned by Peter. Why don’t you just try his suggestion and update to the later version of the package before changing anything else?

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