Filter Get Outlook by DateTime variable


My automation basically logs a DateTime variable when it last uses Get Outlook Mail Messages, so that the next time it is run it extracts all messages after the logged date…

I can’t get the filter right, though. I know I need something like:

“[ReceivedTime >='” + in_StrLoggedDate + “'”

Have tried with a DateTime variable instead of Str, but no success!

Any help appreciated!


1 Like

Buddy @domluke90
Welcome back to uipath community
you were almost right buddy
here you go

“[ReceivedTime] >= ’ " + in_StrLoggedDate + " ’ "

and the variable in_StrLoggedDate should be of type string buddy @domluke90
or if not put like this get the string buddy

“[ReceivedTime] >= ’ " + in_StrLoggedDate.ToString + " ’ "

thats all buddy

Hi @domluke90

Please check with below code.
“[ReceivedTime >= #” + in_StrLoggedDate + “#”

This should work for you.


Thanks guys,

@Palaniyappan this is running but does not seem to pick up emails past the logged date (eg. earlier today in_StrLoggedDate = “05/17/2019 10:30:00” - not picking up the three that were sent after then)

@Vijay_Kumar_C this compiles but seems to throw an error when accessing Outlook

Any other ideas?


1 Like

Buddy your condition looks good
but check with the properties in the get outlook mail activity buddy
like onlyunread message willbe checked by default and if the mail were read already it wont pick buddy
so make it unread and you can do that for each mail with its option as Mark as unread
buddy @domluke90
Cheers @domluke90

Hi! Nope, they’re not checked.

What is strange is that the condition works the other way (eg. “[ReceivedTime] <= ’ " + in_StrLoggedDate + " ’ ")

I’m sure I’m missing something obvious!


Buddy can i see the property of the get outlook mail activity as a screenshot
if possible
Cheers @domluke90


1 Like

Buddy are you getting from any specific folder apart from inbox from your mail
Cheers @domluke90

Yeh, the “CustomerSure” folder is the only one I’m using. It works fine without the Filter Expression, so I’m pretty sure it is not recognising the Received DateTime to be ‘greater than’ the logged DateTime (as it works the other way)


1 Like

Buddy i think i have got it
put the number of mail in TOP property buddy
else we wont get any mail
Cheers @domluke90

Did that work buddy @domluke90

@Palaniyappan Afraid not!

I just logged the last 10 mail message’s Dates to check they’re in same format, they are like: “05/17/2019 10:44:29”

My logged date = “05/17/2019 10:20:00”

Not sure why the filter isn’t working if received date > logged date… :thinking::thinking:

Unless I should Use mailMessage.Header(“Date”) >= in_StrLoggedDate ?


1 Like

Buddy your condition withfilter property is right
but you didn’t mention the no of mails to be read …thats why we didn’t get any mail as output,
if not sure put the default value of 30 in TOP property

Hey @domluke90

I’ve worked on your issue and hereby attaching a sample that could somehow helps you, instead of filtering in get outlook message activity property i’ve done it inside the loop, somehow i feel it is easier and it is working fine for me.

MailMessages.xaml (6.5 KB)

Goutham Vijay

@GouthamVijay thank you! Literally just tried the same thing and it worked :money_mouth_face:

Not as streamlined as the Get Outlook Filter method by producing to List of MailMessage, but getting the correct results!

1 Like


Thank u and Happy Automation…

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