Filter outlook message for the past 2 days

Hi guys sorry for disturbing your again! I have read through one of the forum post and currently I am having this error for this filter on get outlook message activity. But for the top number of the message works! Much appreciated if your can help me again!

Thanks!

Problem

Error: End of statement expected

Continuing the discussion from Get Outlook Messages Filter for Specific Date:

@phoenix123

could you share the error screenshot

@Sreelatha278

Problem

Hi @phoenix123,

Can you paste the expression you are using filter property

@phoenix123

We have to use top field, if the field is blank it won’t return any messages,

as there is no data, we can’t filter it.

@anil5

@Sreelatha278 so without specify the top field, it won’t get the message. But if specify the top field, it will get the message, right?

Hi @phoenix123,

Use the expression like below

β€œ[ReceivedTime] >= '”+now.AddDays(-2).Date.ToShortDateString+"’ AND [ReceivedTime] <= β€˜"+Now.Date.ToShortDateString+"’"

@anil5 hi sir, I still getting the previous I get the red line around received time. But if my company want to get the latest email can the following expression do that I know now the following expression is for getting the past 2 days?

Is there any error when you run the above expression.

If the expression, doesn’t work, close uipath studio and put the expression and try

Yes you can do that use Get outlook activity, and Top property set to 1 which will give the latest message.

@anil5 ok I try both of the solution you suggest!

@anil5 sir, still the same problem

Can you paste this condition which is referring here as 05/07/2019

@anil5 is it filter string in the Get outlook activity?

Yes , the above expression you have to use in filter property of get outlook mail messages

@anil5

β€œ[ReceivedTime] >= '”+now.AddDays(0).Date.ToShortDateString+"’ AND [ReceivedTime] <= β€˜"+Now.Date.ToShortDateString+"’"

To achieve the latest email, you dont have to use the filter, just mention in the TOP filter as 1 , which will retrieve the latest message

Write the whole expression on your own, by seeing the above expression dont copy paste, there is an issue while you are doing copy paste.

Why you are doing this AddDays(0) this is not required

And type exactly like the below expression

β€œ[ReceivedTime] >= '”+now.AddDays(-2).Date.ToShortDateString+"’ AND [ReceivedTime] <= β€˜"+Now.Date.ToShortDateString+"’"

6 Likes

@anil5 looks like I just have to specify the top filter, it can work but for the filtering have been search for any solution but still having the same error. Oh I am try to play around but I put the previous day also having the same error. Ok I will manually type see what is the result.

1 Like

yes,we must have some value in top field.

1 Like

Have you tried?