We have a REST query to _api/search/postquery and it includes a query like this:

ParentLink="https://{site}/{library}/{folder name}"

Most of the time it is working correctly. But in some cases we have a folder like Create a new course and another folder Create a new course the easy way. When querying for the first folder it is also returning results from the second folder because they start the same.

From this MS documentation for KQL I see there is both a : and a = operator. It isn't very clear, but I think = is supposed to be an exact match. In any event I've tried both operators and neither is functioning as an exact match on the ParentLink property.

Is there a way to get an exact match?

Is there some other way to get the contents of a file using search api?

If it matters this is a SharePoint 2013 on-prem that has been migrated to SPO and is using the classic mode.

  • Is that your query? Won't something like this do it for you? /_api/search/query?querytext='FileName="Create a new course"' Nov 19 at 8:51
  • We have related documents in folders and want all the items in the folder. At this point we only know the name of the folder and not the names of the documents in the folder. That is why we use ParentLink. Is there another way to get all the documents in a folder?
    – Rothrock
    Nov 19 at 16:01
  • Ah using the absolut url to the folder should work: /_api/search/query?querytext='site:"https:///server/site//library/Create a new course"’ Nov 19 at 16:52

Your Answer

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

Browse other questions tagged or ask your own question.