Maria99
(Maria99)
October 8, 2021, 9:14am
1
I want to read mail backward follow input from user (input dialog)
Now I use Get outlook activity and use filter as below.
“[ReceivedTime] >= '”+now.AddDays(-(Convert.ToInt32(backDate.ToString))).Date.tostring(“dd/MM/yyyy”)+“'”
Example : I key input = 1
That mean read mail that received today only.
But now It read mail yesterday until today.
Please guide me about it.
J0ska
October 8, 2021, 9:45am
2
It works as expected, isn’t?
today = 10/8
today.addDays(-1) = 10/7
ReceivedTime >= 10/7
In case you want mail of today ONLY the key input should be 0 (zero)
Cheers
What exactly do you want to read? The formula you posted above simply substracts 1 day (with your given input) and then it limits the filter to [yesterday → today].
Also, note that Datetime.Now.AddDays(-1) would go from yesterday to today, based on the hour as well, not just the day. If it is 8 PM, you would substract 24h and would be getting all the mails received at 8PM yesterday as well.
I would recommend something like this:
DateTime.Now.Date.AddDays(day_range_you_want)
0 - would be for the current day
-1 - would be for yesterday and so on
Maria99
(Maria99)
October 8, 2021, 9:52am
4
@Sergiu.Wittenberger I use filter that your suggest as below.
“[ReceivedTime] >= '”+DateTime.now.Date.AddDays(-(Convert.ToInt32(backDate.ToString))).Date.tostring(“dd/MM/yyyy”)+“'”
backDate = 0
But don’t get mail today to me.
Please guide me for solve it.
Maria99
(Maria99)
October 8, 2021, 9:56am
5
@J0ska If I key backdate = 0. It not get mail today to me.
J0ska
October 8, 2021, 10:00am
6
I recommend you to check the reference. There are filtering examples which you need.
Cheers
1 Like
Srini84
(Srinivas)
October 8, 2021, 10:13am
7
@Maria99
If you check below it has gives you very specify result including the time
Maybe you don’t have the results at that time
You can check below to get the today’s mails as below
Hope this may help you
Thanks
Hi
Change the condition like this
And give a try
“[ReceivedTime] > '”+now.AddDays(-(Convert.ToInt32(backDate.ToString))).Date.tostring(“dd/MM/yyyy”)+“’”
It won’t give yesterday mail and give only today’s mail
Cheers @Maria99
system
(system)
Closed
October 12, 2021, 3:14am
9
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.