Fetch emails for Current month's 2nd week only

Hello All,
I am stuck in problem where I need to fetch mails only for current month’s 2nd week. I am using desktop outlook activity and Get outlook mail messages in my workflow.
In filter expression am using ["[ReceivedTime] >= ’ " +now.Month.ToString+ " ’ "] to get current month’s emails…

I tried with this expression also [“[ReceivedTime] >= '” + ate.Now.AddDays(-14).ToString(“dd/MM/yyyy”) + “’ AND [ReceivedTime] < '” + Date.Now.AddDays(-7).ToString(“dd/MM/yyyy”) + “ ’ ”]. Its not working

How to fetch Current month’s 2nd week emails only?

@Pranay_Kumar_Bose

Hi,

The correct expression to get the 2nd week of the current month is:

[ReceivedTime] >= ‘" + DateTime.Now.AddDays(-DateTime.Now.DayOfWeek + 1).ToString(“dd/MM/yyyy”) + "’ AND [ReceivedTime] < ‘" + DateTime.Now.AddDays(-DateTime.Now.DayOfWeek + 8).ToString(“dd/MM/yyyy”) + "’"

Thanks

@Pranay_Kumar_Bose
Try this one:

"[ReceivedTime] >= '" + Date.Today.AddDays(-Date.Today.Day + 8).ToString("MM/dd/yyyy") + "' AND [ReceivedTime] <= '" + Date.Today.AddDays(-Date.Today.Day + 14).ToString("MM/dd/yyyy") + "'"

@rlgandu Am getting an compilation error on this…
Saying “Compilation on Visual Basic (1)”

Thanks @raja.arslankhan Sir.
Its working and giving me the desired output.
Thankyou

@Pranay_Kumar_Bose Please mark it as a solution so that others can get help from it. Thanks

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