I am using CSOM in API. I used following code for content search in documents and now want to integrate People search which can search users from sharepoint website using CSOM.
MethodResponse<ClientResult<ResultTableCollection>> response = new MethodResponse<ClientResult<ResultTableCollection>>();
UserCredential userCredential = new UserCredential();
try
{
userCredential = VerifyToken(token);
if (userCredential != null)
{
_ctx = GetClientContext(userCredential);
if (_ctx != null)
{
KeywordQuery keywordQuery = new KeywordQuery(_ctx);
keywordQuery.QueryText = Convert.ToString(text);
SearchExecutor searchExecutor = new SearchExecutor(_ctx);
ClientResult<ResultTableCollection> results = searchExecutor.ExecuteQuery(keywordQuery);
_ctx.ExecuteQuery();
response.ErrorCode = "200";
response.ErrorDescription = "No Error";
response.Response = results;
}
}
}
I tried searching for this but in vain. Please help.