sharepointsharepoint-2013sharepoint-userprofilesharepoint-jsom

Sharepoint 2013 Add-in JSOM How to get Users Profiles from specific domain?


In the organization deployed sharepoint farm 2013.

In the User Profile Service settings, three connections are created in three different domains.

I need to get all the user profiles from one specific domain (connection).

Does anyone know how to get user profiles from a specific domain ?

I have this code:

function getAllUsers() {
    var clientContext = new SP.ClientContext.get_current();
    var keywordQuery = new Microsoft.SharePoint.Client.Search.Query.KeywordQuery(clientContext);
    keywordQuery.set_queryText(searchTerm);        
    keywordQuery.set_sourceId("B09A7990-05EA-4AF9-81EF-EDFAB16C4E31");
    keywordQuery.set_rowLimit(rowsPerPage);
    keywordQuery.set_trimDuplicates(false);;
    keywordQuery.set_startRow(startRow);

    var searchExecutor = new Microsoft.SharePoint.Client.Search.Query.SearchExecutor(clientContext);   
    results = searchExecutor.executeQuery(keywordQuery);          
    clientContext.executeQueryAsync(onQuerySuccess, onQueryError);
}

I did not find such a property in the search results

Maybe I somehow use this property SPS-SourceObjectDN? but how?


Solution

  • Rajesh.Sitaraman on the forum https://social.technet.microsoft.com/Forums/en-US/512be815-c8dc-4669-a3d2-d3d2f731779c/sharepoint-2013-addin-jsom-how-to-get-users-profiles-from-specific-domain-?forum=sharepointdevelopment&prof=required advised create or change result source in CA.

    I refused this variant and handle search results in the app

            var index = users[i].indexOf("@");
            var domainName = users[i].slice((index + 1), users[i].length);
            if ($.inArray(domainName, domains) > -1) {..}