Forum Discussion
NThoman
Mar 01, 2024Iron Contributor
Submit-PnpSearchQuery Filter on Date
$SearchQuery = "ReportDate=1900-01-01 Path:" + $SiteURL
Submit-PnPSearchQuery -Query $SearchQuery -All -SortList @{Created="Descending"} How do you format the query string to return results wit...
- Mar 18, 2024
Correction... that wasn't returning quite the right results also... however... this is:
$SearchQuery = "(NOT RefinableDate01>1900-01-01 Path:" + $SiteURL +"/Reports/)"
This was a useful resource:
https://www.techmikael.com/2023/04/filter-on-managed-properties-in-search.html
ganeshsanap
Mar 03, 2024MVP
NThoman What is the issue with search query you are using? Is it throwing any error or is it not returning the expected search results?
Try using date range once like below:
ReportDate>=1900-01-01 AND ReportDate<=1900-01-01
Use correct managed property name of your date column.
References:
- SharePoint CSOM Query Keyword Filter On Date Time Type Column
- Filtering query string results by date range
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
NThoman
Mar 05, 2024Iron Contributor
I am not getting any results but there should be thousands. The field was first created with no spaces. The renamed with spaces.
ReporDate —> Report Date
ReporDate —> Report Date