Kieran’s Tech Talk – Searching by data range in SharePoint

Expert Opinion

Kieran’s Tech Talk – Searching by data range in SharePoint

Kieran Cumming October 2, 2017
Kieran’s Tech Talk – Searching by data range in SharePoint

SharePoint search is extremely powerful, and often users & developers don’t know about some of this power. Below are a few date range queries that I’ve found useful in the past.

Searching for items within a particular date range

MyManagedProperty:2017-10-15..2017-10-20

The “..” operator allows us specify a range of dates in the SharePoint search engine.

Searching for items after a particular date

MyManagedProperty:2017-10-15..8900-12-31

Here we search from the date we want SharePoint’s maximum date allowed (31/12/8900).

Searching for items before a particular date

MyManagedProperty:1900-01-01..2017-10-20

The earliest date SharePoint allows in its date fields is 1/1/1900, so we search between that and the date we want.

This can also be used in its inverse to exclude items with dates in the past, such as an expiry date. For example, -ExpiryDate:1900-01-01..2017-10-20 would exclude items with an expiry date before 20/10/2017.

Searching for items with no date

-MyManagedProperty:1900-01-01..8900-12-31

This will exclude all items that have any date, as its range is SharePoint’s minimum allowed date to the maximum allowed date.

Searching for items with any date

MyManagedProperty:1900-01-01..8900-12-31

This will match any non-empty date.

Please reach out should you have further questions!

Thanks for reading.

K.

About the author: Kieran’s IT knowledge surpasses that of many elders. He does anything from back-end code to the user interface, he can script or code his way out of any problem.