Mohammed Arief
Mohammed Arief

Reputation: 61

SearchExecutor (JSOM) did not retrieve values from Sharepoint online user profile

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

Upvotes: 0

Views: 549

Answers (1)

Dmitry Dolotovskikh
Dmitry Dolotovskikh

Reputation: 1

Try this

keywordQuery.set_queryText("mohammed*");

Upvotes: 0

Related Questions