aqiffm
(Aqiffm)
January 4, 2024, 8:04am
1
Im trying to filter my outlook mail message for today from 8AM to 9AM. However, it returned null when the email is there and is still unread.
“[Received] >= '” + DateTime.Today.ToString(“d”) + " 08:00AM’ AND [Received] < ‘"+ DateTime.Today.ToString(“d”) + " 09:00AM’"
This one taken from UiPath docs
mkankatala
(Mahesh Kankatala)
January 4, 2024, 8:16am
2
Hi @aqiffm
Could you check with the below expression
"[ReceivedTime] >= '" + DateTime.Today.ToString("MM/dd/yyyy 08:00:00") + "' AND [ReceivedTime] <= '" + DateTime.Today.ToString("MM/dd/yyyy 09:00:00") + "'"
Note : Don’t forget to mention the specific folder where you want to retrieve mails.
Hope it helps!!
lrtetala
(Lakshman Reddy)
January 4, 2024, 8:16am
3
Hi @aqiffm
Try this
"[Received] >= '" + DateTime.Today.ToString("MM/dd/yyyy 08:00 tt") + "' AND [Received] < '" + DateTime.Today.ToString("MM/dd/yyyy 09:00 tt") + "' AND [IsRead] = false"
aqiffm
(Aqiffm)
January 4, 2024, 8:30am
4
I have tried it and it still returns nothing. I already specify the email folder. Ive tried different outlook filter and returns something.
Example: “@SQL=”“urn:schemas:httpmail:subject”" like ‘%CTT%’"
With the same email, i try to check the date format using mailMessage.Headers(“Date”) , the format is this “Thu, 04 Jan 2024 08:29:58 +0800”
aqiffm
(Aqiffm)
January 4, 2024, 8:31am
5
ive tried this and weirdly its not working. i used different type of email filter and it returns something.
Example: “@SQL=”“urn:schemas:httpmail:subject”" like ‘%CTT%’"
lrtetala
(Lakshman Reddy)
January 4, 2024, 8:33am
6
@aqiffm
Can you please check on this
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") & "'"
Referenc…
mkankatala
(Mahesh Kankatala)
January 4, 2024, 8:33am
7
Could you give me much information about this then we will try to give the proper solution for your query. @aqiffm
aqiffm
(Aqiffm)
January 4, 2024, 8:46am
8
I want to query email for today from 8AM to 9AM
lrtetala
(Lakshman Reddy)
January 6, 2024, 5:56pm
9
Hi @aqiffm
Please try the below Filter condition it’s working
"[ReceivedTime] >= '" + DateTime.Today.ToString("d") + " 08:00AM' AND [ReceivedTime] <= '" + DateTime.Today.ToString("d") + " 09:00AM'"
Regards,
aqiffm
(Aqiffm)
January 10, 2024, 8:04am
10
Thank you for your effort everyone, using the filter is not working eventho I try all the suggestion where I suspect the bug on this. Hence I do the alternative way on this. The steps are as follows:
Filter by subject email and get the top 5 email
For each loop the email, and compare each of them which has the same date and time is >= 8AM and <= 9AM
and among the filtered email, i will compare among them to get the oldest email
system
(system)
Closed
January 13, 2024, 8:04am
11
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.