'date' is not a member of 'system.net.mail.mailmessage' error message

Hi, referring to this solution: https://forum.uipath.com/t/i-want-to-get-the-count-of-emails-that-i-have-received-in-between-12am-to-23-59-on-a-particular-date-please-help/343870

I’m trying to perform the same activity but get ‘date’ is not a member of ‘system.net.mail.mailmessage’ error message on the expression: MailMessages.Where(function(x) Convert.ToDateTime(x.date).ToString(“dd/MM/yyyy”)=Date.Now.ToString(“dd/MM/yyyy”)).Count

I’m a beginner, this is my first robot.

Thanks a lot

@Giovanni_Mac
Welcome to the forum

We assume you are working with get outlook Mail Message activitiy - output: MailMessagesVar

In general we would suggest to work with filters: Get Outlook Mail Messages

Getting the LINQ (for VB) working give a try at (a defensive one)

MailMessagesVar.Where(Function (x) x.Headers.AllKeys.Contains("Date") AndAlso x.DateAsDateTime.Date = Now.Date).Count

when the received date is targeted then also the following variation can work:

MailMessagesVar.Where(Function (x) x.Headers.AllKeys.Contains("DateRecieved") AndAlso CDate(x.Headers("DateRecieved")).Date.equals(Now.Date)).Count

For training purpose we also would suggest to explore a single mail within the immediate panel by e.g.
MailMessagesVar(0) and its properties and methods

Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum

Once above will work we can rewrite the LINQ and incorporate the UTC Offset as well

Hi,

The recent Mail.Actvities package has issue of date in MailMessage.

If you use Mail.Activities package 1.11.4 or above, can you try to downgrade to 1.13.1-preview or 1.12.3, then try your expression or @ppr 's solution.

Regards,

1 Like

Worked with this. Thanks!

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