Monday, 30 May 2016

SharePoint Search: How do I limit a search query to a specific site collection?

The url needs to be as follows (as per this entry):


The C# code the create the querystring is as follows:

string searchRestUrl = "/_api/search/query?querytext='" + text + "+%2b+path:\"" + HttpUtility.UrlEncode(SiteUrl) + "\"'&rowlimit=5";

where SiteUrl is the full url for my site.

No comments:

Post a comment