So I'm trying to create a query using KQL where one of the parameters brings back items that fall under a certain date range - only items that got modified within the past 7 days. Here it is below:
query.QueryText = "(AssignedTo:'" + name + "' ContentType:'Task' StatusOWSCHCS:'Completed' LastModifiedTime>=\"this week\")
The objective is to bring back all tasks assigned to this specific person that were completed within the past week. The rest of the parameters are good to go, but the last doesn't work as intended.
The this week
is built in and while it works, it only considers the start of the week (so probably Monday or Sunday) not the week (7 days) before that task was last modified. I feel like there needs to be some sort of calculation to get this done, but something not hardcoded with actual dates (since it would widely vary between different tasks). What can I do to do this? Thank you in advance.
DateTime.Today
and somehow subtract 7 from it to get the current week-ago-date. – LaLaLottie Apr 11 '16 at 19:01DateTime.Today.AddDays(-7)
. Thank you though! – LaLaLottie Apr 11 '16 at 19:11