Get Mail Message Filter Not Working

Hi,

I’m struggling with filtering my get outlook mail message activity to pull only emails received on the current date (between 00:00:00 Aug 2 and 11:59:59 Aug 2).

I’ve tried using an if statement to check that the time the emails were sent (e.g. 08/02/2019 06:28:59) is greater than today’s start date (08/02/2019 00:00:00) which returns as true, however when I set my dynamic filter as such, it doesn’t pull any mail items. This is what I’m using for my filter, and when printed the datetime prints as 08/02/2019 00:00:00.

[ReceivedTime] >= datetime.Now.Date.tostring

Any ideas on why it wouldn’t be pulling any mail items when the date received is clearly greater than the datetime used in the filter?? Any help is greatly appreciated!!

Hi @caitlinscott

While I’m aware that this topic is not recent, I felt compelled to share the solution in case it proves beneficial to anyone encountering a similar issue.

"[ReceivedTime] >= '" + DateTime.Today.ToString("d") + " 00:00AM' AND [ReceivedTime] <= '" + DateTime.Today.ToString("d") + " 11:59AM'"

Regards,

3 Likes

My Previous Working Approach

In my previous implementation using the Get Outlook Mail Messages activity, I successfully used the following filter, which worked as expected:

vb

Skopiuj kod

"[ReceivedTime] >= '" + DateTime.Today.AddDays(-IntDayStart).ToString("d") + " 00:00AM' AND [ReceivedTime] < '"+ DateTime.Today.AddDays(-IntDayEnd).ToString("d") + " 00:00AM'"

This filter correctly retrieved emails within the specified date range when used with the Outlook activity.