how can I search on a document library for the folders containg a specific name? where is the doc for that?

I want to seach my document library "MyDocs" for folders containing, in the title, a specific code

What I tried

  const rootPath = "https://mycompany.sharepoint.com/sites/my-site/";
  const rootFolder = "MyDocs";

  const searchQuerySettings = {
    TrimDuplicates: false,
    RowLimit: 1,
    // ?? SelectProperties: ["Title"]

  const query = SearchQueryBuilder(
    `iscontainer:true path:${rootPath}${rootFolder} title:*${item.code}*`,

and I get not really OK as result:

enter image description here

1 Answer 1


for people having same issue, fixed the

`iscontainer:true path:${rootPath}${rootFolder} title:*${item.code}*`,


`contentclass:STS_ListItem_DocumentLibrary iscontainer:true path:${rootPath}${rootFolder} title:"${item.code}"`,

so, the main modification is * => " in title

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.