2

I am having issue while searching using query text in a specific site. When I use following get query, https://client.sharepoint.com/_api/search/query?querytext='vpn', I get results in the entire site of client.sharepoint.com I also get results when I search for term 'vpn' directly in site https://client.sharepoint.com/sites/SysDocs. Now I need to combine both. When I use https://client.sharepoint.com/_api/search/query?querytext='vpn+path:"https://client.sharepoint.com/sites/SysDocs"', it is not returning me results.

What should I change in the syntax for getting 'vpn' results in site https://client.sharepoint.com/sites/SysDocs ? Please advise !!

Thanks !!

  • 1
    can you try it as https://cl‌​ient.sharepoint.com/_api/search/query?querytext='(vpn)+AND+(path:https://client.sharepoint.com/sites/SysDocs)' and check ? – Gautam Sheth Jan 7 '18 at 17:09
  • Still getting same issue. No results returned. – user72980 Jan 7 '18 at 17:34
  • How about https://cl‌​ient.sharepoint.com/_api/search/query?querytext=‌​'vpn AND path:htt‌​ps://client.sharepoi‌​nt.com/sites/SysDocs‌​' ? It works at my end – Gautam Sheth Jan 7 '18 at 17:54
  • I am still getting no results. In SharePoint query search tool, my query becomes like this client.sharepoint.com/_api/search/…‌​ps:%2f%2fclient.sharepoi‌​nt.com%2fsites%2fSysDocs‌​' Not sure if I can pass you the screenshot but when I directly search vpn under the site on sharepoint, I get lot of results. So expecting this to return me results. I tried other search strings also but same result This is office365 sharepoint api calls. – user72980 Jan 7 '18 at 18:14
  • ok thats strange, i am using POSTMAN and its giving me correct results. Can you try hitting the query in the browser and check ? – Gautam Sheth Jan 7 '18 at 18:15
0

You should modify your endpoint url as below :

https://cl‌​ient.sharepoint.com/_api/search/query?
querytext=‌​'(vpn)+AND+(path:htt‌​ps://client.sharepoi‌​nt.com/sites/SysDocs‌​)'

or

https://cl‌​ient.sharepoint.com/_api/search/query?
querytext=‌​‌​'vpn AND path:htt‌​ps://client.sharepoi‌​nt.com/sites/SysDocs‌​'
  • Have posted it as answer. Please accept it by checking the checkbox below the button or as mentioned here :) – Gautam Sheth Jan 8 '18 at 11:19

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.