Forum Discussion
Jedrek96
Jan 19, 2024Copper Contributor
SharePoint Online Filter By URL
I am working with the SharePoint API and trying to filter search results based on specific URLs. Currently, I have the following search query:
http://www.test.com/_api/search/query?querytext=%27Hello%27&trimduplicates=false&sortlist=%27Write:descending%27&rowlimit=5000
I want to filter the results from the API results.. based on the following URLs:
https://www.test.com/SiteTest https://www.test.com/Divisions/Academy https://www.test.com/Divisions/National
Is there a specific filter or URL parameter that I can use in the SharePoint API to achieve this?
I appreciate any guidance or examples on how to implement this filtering logic?
- Hi,
you can use the Path property in order to limit your results to specific sites
(Path:https://xyz.sharepoint.com/sites/site1 OR Path:https://xyz.sharepoint.com/sites/site2/)
You can use this tool in order to test your query https://github.com/pnp/PnP-Tools/blob/master/Solutions/SharePoint.Search.QueryTool/README.md
Cheers,
Federico I have answered your question here: SharePoint Online Filter By URL
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.