How to retrive mails -5 days mails to till today

Hi All, i’m facing an issue with mails i want -5 days mails and how to get it
Ex : 02-01-2022 to 06-01-2022 these date range mails
can anyone help me how to do it

Hello,
can you try this ? How to filter by the current month with the Get Outlook Mail Messages activity - #6 by ghazanfar
And changing now.month.Tostring by the date you want (idk if today - 5 works ^^ )

Hi @Constant_Roux this is not working for me it is throwing some error

Hi @Rana_Reddy

You use this below syntax in if activity

Item.Date.Equals("02-01-2022") Or Item.Date.Equals("03-01-2022") Or Item.Date.Equals("04-01-2022") Or Item.Date.Equals("05-01-2022") Or Item.Date.Equals("06-01-2022")

Inside the if activity you can retrive your content from that particular date

Where item is the iterative variable from for each activity

Hope its solves your issue

Thanks
Robin

@Robinnavinraj_S but for using this condition, i need to read all mails right from inbox

Yes then only it will filter out the required date

@Robinnavinraj_S i don’t want to read all mails , i want to get only that -5 days range mail if we write some condition in get outlook mail message or get imap mail message.
i’m looking for that kind of command because i can’t read all mails and that requirement is not suitable for my scenario.

Hi @Rana_Reddy

Check this post:

Filter Mail Messages Between Two Dates - Help - UiPath Community Forum

Hope this helps!

Regards Robert

Hi @Rana_Reddy

kindly use this syntax in filter property of get outlook mail message activity

"[ReceviedTime] >= ‘01/02/2022’ AND [ReceviedTime] <= ‘01/06/2022’

Hope its solves your issue

Thanks,
Robin

1 Like

if the [ReceiverdTime] doesn’t work you could try using @SQL=urn:schemas:httpmail:datereceived method

@Robinnavinraj_S i’m getting errors when i use any conditions

Hi All,
i’m getting an error when i use any condition in FILTEREXPRESSION. I’m attaching sceenshot below.

I’m attaching my workflow below

Main.xaml (7.1 KB)

Hi @Rana_Reddy,

U are probably getting this error because of the Filter Expression u filled in: Recevied should be Received.

U can also check this : Get IMAP Mail Messages (uipath.com)

One of the filter expression example here is: “SINCE 23-Feb-2021”, try this and replace the date with a string variable: DateTime.Now.AddDays(-5).ToString(“dd-MMM-yyyy”)

Regards Robert