I need a little remembering on pnp.search() queries. I know from a verified source that you can use either query text, SearchQuery Interface or SearchQuery Builder. No worries about that (except that i haven't played with these yet)

No, my question is more about ... how to build your text query. I've downloaded and installed SharePoint Search Query Tool v2.8 to help me building my Query.

But I can't remember how to build queries anymore, and that's a bit of an issue.

What do I have ?

Using Sharepoint Online, I will have a List called M_Didacticiel set up any where on SP. It could be on a site, on a site collection, or anywhere else.

M_Didacticiel has 4 columns that i will be using :

  • Title (sample : "how to retrieve a potato from the fridge")
  • M_Answer (sample: "By opening the fridge and search for a potato in it")
  • M_Category (sample: "Housekeeping")
  • M_codeLanguage (sample : "en-US - English(USA)")

What should my query perform ?

What I want to do in my query is to retrieve every Item (with columns Title, M_Answer and M_Category) of this list, wherever it could be, with M_codeLanguage equal to a variable i'll be having, and then sorting it by M_Category.

So i am just bumping into the first issue wich is "How do I ask SP to retrieve every Item (without sorting or filtering) of a list that could be anywhere in my tenant ?"

If you have any idea and could help me remember, I would be very glad to hear it :)

Thanks a lot and Have a nice day !


If I understand correctly, You want to retrieve all items from the "M_Didacticiel" list(s) that can exist in any sites/site collections.

I would use a custom content type as default for that list and save it as template. Write query to ask search to bring all items associated with that content type. As long as the 4 columns are not lookup columns, they should be able to be included (there are other exceptions but in your case looks fine.)

Sample query:


Tip: Use SPContentType instead of ContentType

  • 1
    Thanks @YogaPanda, I did not thought of a custom content type. I just have to make it work now. :) – Gaelle Aug 24 '18 at 9:34
  • 1
    Just, the problem is that SPContentType is empty on every item of my list. So i'll just use the old ContentType. :) – Gaelle Aug 24 '18 at 9:46
  • @Gaelle No problem! vote for the answer if it the answer is helpful ty :) – YogaPanda Aug 24 '18 at 15:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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