Email - GetOutlookMailMessage - How to retrieve Received Date, Modified Date and Message ID from each email

Hi,

I am looking to retrieve a number of properties from each email after executing the ‘GetOutlookMailMessage’ step.

I am able to pull out the From, To, Subject, Body and Attachments.

I need to be able to pull out the Received Date, Modified Date and Message ID (this is a unique identifier for each email).

I believe the problem is that the MailMessage class does not contain these properties on their own (perhaps they exist in the headers).

Any suggestions or solutions would be most welcome.

7 Likes

Hello!

Follow a example to get all of this properties.

getMailProperties_Example.xaml (10.1 KB)

Hope It Helps!

Regards,

4 Likes

Hi @Marshall_Belknap,

You can access headers of the email object like this : myMailVar.Headers("property").

To have an exhausted list of the properties you can get from the headers, you can get them from this link MailMessage.Headers Propriété (System.Net.Mail) | Microsoft Learn.

Hope that helps.

Regards,

Masiré

8 Likes

Masire, thank you so much,

When I try this in UiPath, I get the following error:

It seems as if it doesn’t recognize the single quote at the end of the property name. Any thoughts?

Ok, so I figured it out.

In UiPath, it needs to be written like this:

mailVar.Headers(“Date”)

Thanks again

9 Likes

Ok! I edited my answer :wink:

i am trying to use Gteoutlookmail message to pick one oldest unread mail and mark it as read.using headers will happen only after getting a group of messages… i want to mark only one mail as read.

Hi,

Is it possible to insert your solutions? :slight_smile:

@Marshall_Belknap

How can I get message ID? I tried “mail.Header(“Id”)” . It is giving nothing.

Regards,
Krishnakanth

I got the solution for that. I’ve used “mail.Header(“Message-ID”)” and it’s working fine.

2 Likes

Hello Lucas.Pimenta
As you provided the solution, it no containe about the Date.Please once check above question