Extract Current Hour emails using Get exchange mail activity

Hi,

We have a requirement where we need to Extract Current Hour emails using Get exchange mail activity. Using the below, we can filter today’s email. But we need to extract emails received in current hour.

mailMessagesList.Where(Function(x) DateTime.ParseExact(x.Headers(“Date”), “MM/dd/yyyy HH:mm:ss”, Nothing).Date.Equals(DateTime.Now.Date))

Thanks in Advance.

Thanks,
Sudha.

Hope this thread would help you resolve this

Cheers @SudhaRajesh

Thank you Palaniyappan!

It is working as expected.
To extract last 60min emails: cdate(item.Headers(“Date”)) < datetime.Now and cdate(item.Headers(“Date”)) > datetime.Now.AddHours(-1)

To Extract Current hour Emails: cdate(item.Headers(“Date”)).ToString(“hh”).Equals(datetime.Now.ToString(“hh”))

Thank you!

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