KeywordQuery filter by Start and End dates using Today
-
08-10-2020 - |
Question
I have a KeywordQuery that I need to filter so the current date is between the Start Date and End Date.
Today >= "Start Date" && Today < "End Date"
Solution
I think there are four issues with what you are trying:
Your managed property names cannot have spaces in them, i.e. presuming start date and end date are your list columns, you need to find the names of managed properties associated with them.
So your query might become like this:
Today >= "StartDate" && Today < "EndDate"
You will need the order reversed for properties and the values you are comparing with.
StartDate <= Today && EndDate > Today
Then you need to remove the white spaces between operators and keyword, and operators and values.
StartDate<=Today && EndDate>Today
And then, you need to switch your && operator for AND.
StartDate<=Today AND EndDate>Today
References:
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange