0

I'm trying to perform people search in SharePoint online user profile from Sharepoint hosted app but it returns no data.

I'm using the following code to do this:

clientContext = new SP.ClientContext.get_current();

// Building Keyword query for the search
var keywordQuery = new Microsoft.SharePoint.Client.Search.Query.KeywordQuery(clientContext);

keywordQuery.set_queryText("mohammed");
keywordQuery.set_sourceId("B09A7990-05EA-4AF9-81EF-EDFAB16C4E31");
keywordQuery.set_rowLimit(500);
keywordQuery.set_trimDuplicates(false);

var searchExecutor = new Microsoft.SharePoint.Client.Search.Query.SearchExecutor(clientContext);
results = searchExecutor.executeQuery(keywordQuery);

clientContext.executeQueryAsync(
            function () {
                alert(results.m_value);
            },
            function (err) {
                alert("Error");
            }
        );

I'm trying to search user profile which contains "mohammed" text.

searchExecutor.executeQuery(keywordQuery) executes without any error but results.m_value returns 0. If I get value from results.m_value then I can move towards reading UserProfile properties using PeopleManager

Note: I've user as Mohammed Arief Kannubasha

Anyone please advice, thanks in advance

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

1 Answers1

0

Try this

keywordQuery.set_queryText("mohammed*");