Get outlook mail messages after a certain datetime

If you dont need background information, just go straight to the question at the bottom.
I am working on a project. The project includes email reading process on hourly basis.
Currently, I simply read all emails and mark them as read. But when my robot throw exception and crashes, it can not re-process those emails I read since it is marked as read. I have to manually select and mark those emails as unread again in order to re-process them.
After that I decide to not mark emails as read at beginning of my process. I simply read emails at beginning and at the end of my process I read emails again to mark as read. But this cause another interesting problem: If I receive emails after robot starts & before robot ends, I will falsely mark the unprocessed email data as read as well.

[QUESTION:]
I want to find an approach to read emails sent within a certain time interval (09:30-10:30, etc).
Or read emails after a certain datetime(after 09:30, etc).
Or simply find a way to mark emails as read emails, not in “Get Outlook Mail Messages” activity, but within the for each loop of email list I got from “Get Outlook Mail Messages” activity.
There must be a way to achieve my goal… If my demand confuse you, please go through background info.

Thank you all.

Hello!

You can use the Filter Property to try to achieve your goal :slight_smile:

Refer to these:

Hope it Helps :slight_smile:

Regards,

1 Like

@eb978xz
If you want to read emails based on Datetime you can use below in filter property

“[Received]>= '” + now.AddDays(0).ToString(“D”) + “'”
“[From]= ‘Input Mail’”

now.AddDays(0).ToString(“D”) is only considering date part, time is not being considered, do we have any solution for that?

I have to get mail (from Sent Items folder) based on Sent time in Get Outlook activity and the Outlook Language: language was in German.

kindly share the Filter syntax to get the mail based on sent time.

Thanks,
Tharma KS

Hey… thanks for the answer… any clue why it wouldn’t work without addDays(0) as logically we are not adding any days so this part is redundant…

Also we were using the format today.tostring(“MM/dd/yyyy hh.mm yy”) which was working since last 3 months in ‘Get Outlook Mail Messages’ filter but suddenly it stopped working… anyone else has experienced this?

I have used same expression, but it does not seem to be working. Any alternatives?

Used Filter : Both are not working (Last 5 Hours)
“[Received]>'”+DateTime.Now.AddHours(-5).ToString+“'”
“[ReceivedTime]>'”+DateTime.Now.AddHours(-5).ToString+“'”

You can use :
“@SQL=urn:schemas:httpmail:datereceived>='”+DateTime.Now.ToUniversalTime.AddMinutes(Your GIVEN DURATION AS STRING ).ToString(“MM/dd/yyyy HH:mm tt”)+“'”