Is it possible in SPO search to build a query that will return only documents that are directly in a document library (not in folders)? is there any property that can tell whether specific document is placed in a folder or not?

1 Answer 1


Yes, you should be able to use url depth to locate the files in the root of the library

  • As I can see, it's not possible to recognize in url which word is a folder name. Subsite, document library or folder name is just a word after \. See below example: document in root of the library: company.sharepoint.com/:w:/r/sites/Site1/SubSite1/… document in a folder: company.sharepoint.com/:w:/r/sites/Site1/SubSite1/…
    – Przlwo
    Feb 8, 2019 at 8:11
  • from above two urls how to recognize that folder1 is really folder name (not a library) ?
    – Przlwo
    Feb 8, 2019 at 8:31
  • Try to inspect the library in the SharePoint Search Query Tool, and have a look at the managed properties isDocument and UrlDepth. That should be sufficient to pinpoint the documents Feb 8, 2019 at 22:54

Your Answer

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

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