Date not working from Email

Hello,

I am using item.Header(“Date”) to grab the date of an email. This process used to work and would grab the dates with no problem, however, now it is showing empty everytime it tries to get the date, I know it is grabbing the correct emails as other data is coming through correctly. Is there any other way to grab the date of an email?

Thanks

are you reading your emails from the draft folder? thats one reason why date is showing empty string

you can also try

"DateCreated", or
"DateReceived",

It is coming from a shared inbox folder, I am also grabbing information from the subject and body which comes through fine, it’s just the date coming up blank. I tried DateCreated and DateReceived but no luck. I’ll try it on another email inbox to see if it is just that one and let you know.

It is happening for every email regardless of inbox.

Hello,

Can you please try to print the headers like this and check the date key:
ListOfMails(0).Headers.AllKeys

Thanks!
Athira

So i put that in a log message and it prints System.String.

use the debug panels e.g. immediate panel
Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum

Hello,

Please use a break just after retrieving the mails and search it in immediate window like this:

Thanks!

So I have put the breakpoint after retrieving the mail, but when I click on immediate, I don’t see all the things you see, it is just a blank panel.

Hi @deguy42 ,

You would require to type in and enter the values as highlighted in the image above next to the Prompt > shown in the immediate panel.

As @supermanPunch mentioned, you have to type and click enter to get the values:

Thanks!

I did try typing in there and pressing enter but nothing happens. It stays blank.

That’s weird. Then can you please check the locals and search for headers and get the headers from there ?

Thanks!
Athira

I did this and noticed that Headers only has Headers=HeaderCollection(2) { “Uid”, “Message-ID” }. How do I fix this?

Which activity are you using to retrieve mails?

Get mail - Outlook activity . This is the one I have always used and never had any issues with it. Has something changed with the activity?

I am also using the same and I am able to retrieve it. I think your outlook group policies changed and that’s why you are not able to retrieve any other headers. You can check about it here:

Thanks!

1 Like

Hello, had the same problem. Refer this link. It uses Microsoft Office 365 Scope.