I am struggling to fine the KQL syntax to retrieve search results only from a library name "DPCDocuments" who's Path is like http://{our tenant}.sharepoint.com/teams/{project number}/DPCDocuments I tried path:"https://{siteURL}/DPCDocuments/*" , path:"*/DPCDocuments/*" and other variation and it did not work.

Also, I get results from "/PreservationHoldLibrary/" (the deleted items) and I want to always exclude them. How do I do that? Thanks

1 Answer 1


1.At the beginning, I search FolderList.xlsx file will get three display results.

enter image description here

2.Edit page (https://tenant.sharepoint.com/.../Pages/results.aspx) >> Edit Search Results web part

3.On the Search Results Panel, click on Change query button.

enter image description here

4.On the Bulid Your Query window, set property filter

  • KQL: SitePath Starts with https://{siteURL}/libraryname/*

enter image description here

5.Publish page

6.Then, you can get results only from the Documents Library(Shared%20Documents)

enter image description here

  • I am using the pnp-modern-search it should use the same SitePath Starts with https://{siteURL}/libraryname/* But I will check again. Thx
    – Ofer Gal
    Commented Aug 17, 2021 at 15:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.