How to filter outlook email messages received "today"

Hi everyone!

I want to filter all the outlook mail messages by the day that the robot runs. I have tried many solutions found in the forum, but none of them really works for me.

Either filter properties, assign or If condition, would anyone provide a solution for me, please?

What’s the reason? Are you getting wrong Output after filtering? Or any error?

This below filter expression works correctly though

"[ReceivedTime] >=' + Now.AddDys(-1) +'"

If you are getting any errornoes output, make sure to check the timezone for the machine where robot is running, just in case it is incorrect or not as expected.

Hi @rahulsharma

Thanks for your reply. Your answer works to filter the email messages sent within 24 hours, but would it be available to filter by the date the robot runs? For example, when I run the robot at 6 pm today, I just want to filter the email received today. Even within the 24 hours range, the email received by yesterday 10 pm should not be counted. Would UiPath be able to do this, or must be strictly subjected to 24 hours range?

Try this

"[ReceivedTime] >=' + Now.AddDays(-1).toString("MM/dd/yyyy 23:59:59")+'"

You can try storing System.Datetime.Now to a datetime variable (“currenttime”). Now, subtract this datetime from when it was 00:00:00, call the variable “diff” and make sure diff is also a datetime variable. Now you will have a range of times you can filter through.

Next, set the parameter of the bot to only process email messages between the “currenttime” variable and the “currenttime” - “diff”.

There is your range of emails to filter through that landed on the same day as when the bot ran.

Take a look at these screenshots (Deleted previous blurry ones).
Please make sure all the time variables are set to DateTime and the “diff” variable is set to genericvalue


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