Filter Outlook Email: Get Emails for the last 30 days


#1

I have tried the filter in the UiPath Essentials Training - E-mail Automation 3.3 but it is giving me an error.

my Filter: “[ReceivedTime] >= '”+now.AddDays(-30).ToString(“MM/dd/yyyy”) +"’"

Error:
Main has thrown an exception

Source: Get outlook mail messages

Message: Cannot parse condition. Error at “'05/05/2018’”.

Exception Type: COMException

System.Runtime.InteropServices.COMException (0x80020009): Cannot parse condition. Error at “'05/05/2018’”.
at UiPath.Mail.Activities.GetMailActivity.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)


#2

Hi @criskitz,

Alter your filter statement to something like this,

“[ReceivedTime] >= '”+now.AddDays(-30).ToShortDateString+"’ AND [ReceivedTime] <= ‘"+now.ToString +"’"

It will get you last 30 days mails


#3

it is giving me the same error cannot parse…

Main has thrown an exception

Source: Get outlook mail messages

Message: Cannot parse condition. Error at “'05/05/2018’ AND [ReceivedTime] <= ‘06/0…”.

Exception Type: COMException

System.Runtime.InteropServices.COMException (0x80020009): Cannot parse condition. Error at “'05/05/2018’ AND [ReceivedTime] <= ‘06/0…”.
at UiPath.Mail.Activities.GetMailActivity.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)


#4

Hi,

Check the system datetime format, it may be in a different format.


#5

this is my system date. what will i do then?

image


#6

i used the following filter below. no error but it is not getting the emails.

“[ReceivedTime] >= '”+now.AddDays(-30).ToShortDateString+"’ AND [ReceivedTime] <= ‘"+now().ToShortDateString+"’"


#7

this is now resolved! i put a value in TOP field. now it is getting the emails! thank you!

image