cancel
Showing results for 
Search instead for 
Did you mean: 

MS Outlook VBO

ShobhitMalaviya
Level 3
Hi,

I am trying to create a process wherein I need to scan the mails in outlook based on the sender email and subject. Once I am able to filter out these mails based on the selection criteria I want to pick only the mails that have come after a certain date and time. I am able to pull the email based on the sender and  subject  and  get the timestamp of the latest email, however I am facing difficulties in writing the expression to compare this time stamp with the threshold date criteria. For example I get the time stamp of the latest email in variable "latest time stamp" with value  12/02/2020 10:00:00 and I need to check whether this date time is after 9am today's date can anyone please tell me how to write an expression to do this comparison?

Regards,
Shobhit Malaviya

------------------------------
Shobhit Malaviya
------------------------------
1 BEST ANSWER

Best Answers

Here is an expression to get a DateTime for today at 9 am: ToDateTime(ToDate(Today()) & " 09:00:00")

As Eric mentioned, you can use several of the logical functions to compare this DateTime to  a input DateTime like your email timestamp. 
One thing to look out for is the format of your input and your date and time settings. For example, 12/02/2020 could be interpreted as December 2 or February 12 depending on your local settings. You might need to use FormatDateTime or the date & time manipulation utility to get everything in the same format.

------------------------------
Patrick Aucoin
Senior Product Consultant
Blue Prism
------------------------------

View answer in original post

2 REPLIES 2

ewilson
Staff
Staff
Blue Prism includes a DateTime type. You can set it's value to whatever timestamp you pull from the email and then compare that data item to a second data item with your check time stamp using a Decision stage and a regular logical ">" (greater than sign). Alternatively, you can do it all in a code stage using the regular .NET DateTime type as depicted in this Microsoft documentation.

https://docs.microsoft.com/en-us/dotnet/api/system.datetime.compare?view=net-5.0

Cheers,

------------------------------
Eric Wilson
Director, Partner Integrations for Digital Exchange
Blue Prism
------------------------------

Here is an expression to get a DateTime for today at 9 am: ToDateTime(ToDate(Today()) & " 09:00:00")

As Eric mentioned, you can use several of the logical functions to compare this DateTime to  a input DateTime like your email timestamp. 
One thing to look out for is the format of your input and your date and time settings. For example, 12/02/2020 could be interpreted as December 2 or February 12 depending on your local settings. You might need to use FormatDateTime or the date & time manipulation utility to get everything in the same format.

------------------------------
Patrick Aucoin
Senior Product Consultant
Blue Prism
------------------------------