Get Outlook Mailt Filtering by Date

Hi guys :slight_smile:

I want to get my mails filtering by yesterday to today. For this i want to use outlook filtering option method instead of mail.header(“date”).

When i put " [ReceivedTime] >= ‘07/29/2019’ AND [ReceivedTime] <= ‘07/30/2019’ " That work!
But when i replace fixed date by now.date.AddDays(-1).ToString(“MM/dd/yyyy”) and now.date.ToString(“MM/dd/yyyy”) that doesnt work

hmmm help me please (i already checked other post in the forum)

ty

1 Like

Fine
the condition be like
"[ReceivedTime] >= ’ “+Now.AddDays(-1).ToString+” ’ AND [ReceivedTime] <= ’ " + Now.ToString + " ’ "

Cheers @freeloxxx_lol

1 Like

I tried, it seems good but I ve the same error: range cannot be negative (no mails found)

Sequence1.xaml (5.0 KB)

1 Like

Condition is not corret
I think we re struggling with double quote and simple quote xD

hey @freeloxxx_lol
try this,

“[ReceivedTime]>=’“+Now.AddDays(-1).ToString(“dd/MM/yyyy”)+”’”
I think this is enough, because received time is anyway gonna less than now isn’t it? :slight_smile:

@freeloxxx_lol
Check this sample workflow…its works for me…
Main.zip (11.2 KB)

check this condition
assign two variables like “ToadysDate = System.DateTime.Now” and “YesterdaysDate = now.AddDays(-1)” and using this filter condition check the screenshot also
“[ReceivedTime]>='”+YesterdaysDate.ToString(“MM/dd/yyyy”)+“'” +“And”+“[ReceivedTime]<='”+ToadysDate.ToString(“MM/dd/yyyy”)+“'”
try this one and solve your problem

The issue was not code, but the target folder mails… I move mails to a folder to create my testing environment and no ones was in Day(-1) range xD

Ty for helps guys!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.