What I am trying to do is to Get all sites from the search API.

This REST API url works perfect: http://localhost/_api/search/query?querytext='path:http://localhost/teamsites/*+OR+path:http://localhost/supportsite/*+OR+path:http://localhost/funsite/*'&trimduplicates=false&rowlimit=50&refinementfilters='contentclass:equals("STS_Web")'

I get 17 sites with that rest url.

This is in .NET CSOM:

    using (var clientContext = new ClientContext(SPContext.Current.Web.Url))
        var keywordQuery = new KeywordQuery(SPContext.Current.Site);
        keywordQuery.TrimDuplicates = true;
        keywordQuery.QueryText =
            "path:http://localhost/teamsites/* OR path:http://localhost/funsite/* OR path:http://localhost/supportsite/*";
        keywordQuery.RowLimit = 200;
        var searchExecutor = new SearchExecutor();
        ResultTableCollection results = searchExecutor.ExecuteQuery(keywordQuery);

        foreach (var s in results)
            var l = s.ResultRows;



Note: It seems that the problem is in refinmentFilters method.

Any kind of help is appreciated!


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.