Filter Outlook Email: Get Emails for the last 30 days

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)

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

1 Like

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)

Hi,

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

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

image

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

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

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

image

Which one works ? Please mark the solution or please share workflow solution xaml