Get Outlook mail message Filter

I am using same condition in filter it’s not working.

“[Received] >='” +Date and time.Today.ToString(“d”)+“00:00AM’”

But
Using this condition is download all mail attachments…

“[Received] <='” +Date and time.Today.ToString(“d”)+“00:00AM’”

I want only today’s attachments only…

Please help me…

Try these filters:

"[Received] >= '" + DateTime.Today.ToString("d") + " 00:00AM'"

or

"[ReceivedTime] >= '" + DateTime.Today.ToString("d") + " 00:00AM'"

or

"[Received] >= '08/08/2022' AND [Received] <= '08/10/2022' "

Reference: Get Outlook Mail Messages


If you want for three days ago:

"[Received] >= '"+now.AddDays(-3).Date.ToShortDateString+"' AND [Received] <= '"+now().Date.ToShortDateString+"'"

sFilter = "[Received] > '" & Format("8/10/2022 3:30pm", "ddddd h:nn AMPM") & "'"

Reference: Items.Find method (Outlook) | Microsoft Learn

Check this solution also: Get Outlook Messages Filter for Specific Date - #12 by prasanthpulipati

Let us know if these helped.

1 Like

Hi Marian
Tq for the help

It’s all conditions is try

I want only today’s outlook mail attachments only.

But not download today mails attachments…
Ple help me…

This is working yesterday but today not working
“[Received] >='” +Date and time.Today.ToString(“d”)+“00:00AM’”

Double check the filter as it seems is not correct
image

Are you sure that you tried at least one filter from the previous post?

Are you having emails with attachments in your Outlook email that were received today? Double check manually in Outlook.

Yes Marian

I am trying last 3 days condition is working

But
I want todays mails attachments s only

Try this filter as it is working internally. Double check the quotes.

"[Received] >= '" + DateTime.Today.ToString("d") + " 00:00AM'"

Marian

It’s not working…

Try to update the UiPath.Mail.Activities to 1.12.3

Yes marian.
update the UiPath.Mail.Activities to 1.12.
But same issue in this…

Provide a screenshot of the Get Outlook Mail Message properties tab (we need to see MailFolder and Filter), the encountered error in the Output panel and the Project panel to see the Dependencies.

But this filter is working?

"[Received] >= '"+now.AddDays(0).Date.ToShortDateString+"'"




explore within your RnD if there is needed to take care about the offset from your time zone to the email assumed / used time.

to illustrate it more:
2 hours ahead from UTC (UTC+ 2)
an email received at 19:00 (= 17:00 +2) will be catched by filter for 17:00 and ignored for 19:00

I repeat again, the filter is not correct (a space is missing):

image

Copy this filter and use it:

"[Received] >= '" + DateTime.Today.ToString("d") + " 00:00AM'"

My problem is

I am using condition in filter it’s not working.

“[Received] >='” +Date and time.Today.ToString(“d”)+“00:00AM’”

But
Using this condition is download all mail attachments…

“[Received] <='” +Date and time.Today.ToString(“d”)+“00:00AM’”

I want only today’s attachments only…

Please help me

Yes try to

“[Received] >= '” + DateTime.Today.ToString(“d”) + " 00:00AM’"

But not working…

we already got it from above

Just do an RnD like following:

  • send an email to the email box
  • checkout the received date: e.g 10:55
  • test a filter with todays date and 10:55 time info
  • check if the email is catched or not by the filter
  • adapt the time info by the difference from your timezone to GMT
  • check again
    if the email is catched with / without the GMT offset then you cleared on how the filter is working internally

Hi
Peter

I am using

“[Received] >= '”+now.AddDays(-3).Date.ToShortDateString+“’ AND [Received] <= '”+now().Date.ToShortDateString+“'”

Download last 2 days attachments it’s working .

Did you try this one?

Yes Marian but not working only -3 is working
-2,-1,0 not working