lundi 16 mars 2015

Sharepoint define search scope using csom



I have a sharepoint installation with multiple site collections, let's say siteA, siteB e.t.c


I am using the following code to search in sharepoint



using (ClientContext context = Connect())
{
KeywordQuery keywordQuery = new KeywordQuery(context);
keywordQuery.QueryText = "text to search";
SearchExecutor searchExecutor = new SearchExecutor(context);
ClientResult<ResultTableCollection> results = searchExecutor.ExecuteQuery(keywordQuery);
context.ExecuteQuery();
}


and the results i am getting are from all sites siteA, siteB etc. Is there anyway to specify that i want the search to be performed only in siteA and to be even more specific only in Shared Documents of siteA?








0 commentaires:

Enregistrer un commentaire