Outlook mail filter by Date

Hi
Please help me on this
When i am using filter email by date expression

then i am getting error like this
For each: String was not recognized as a valid DateTime.

Please help me

Hi @Vivek_Kumar4 ,
what value are you getting in mail.Headers("Date")

can you print that value before converting

Regards,
Arivu

Thanks for Replying

see what i am getting

Hi @Vivek_Kumar4 ,

The error message showing your variable “todayMessage” is not an datetime format
todayMessage - data type & what you are trying to do

Regards,
Arivu

Hi @Vivek_Kumar4

Try this

mailMessages.Where(Function (x) CDate(x.Headers("Date")).Date.Equals(DateTime.Now.Date))
1 Like

Thanks @kumar.varun2
Its working fine

can we check email count ? after this expression without using for each activity

@Vivek_Kumar4

mailMessages.Where(Function (x) CDate(x.Headers(“Date”)).Date.Equals(DateTime.Now.Date)).Count

Thanks @kumar.varun2
Its working fine

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