I need to display all the users from the User Profile Service with some basic properties like name email in a web part in sharepoint 2013.

Please help on this.


2 Answers 2


Use search to get all the users. Make sure you define some kind of sorting.

C# on-prem sample:

private static DataTable GetPeople(SPSite spSite, string queryText)

    var keywordQuery = new KeywordQuery(spSite)
        QueryText = queryText,
        KeywordInclusion = KeywordInclusion.AllKeywords,
        HiddenConstraints = "scope:" + "\"People\"",                
        ResultTypes = ResultType.RelevantResults,
        RankingModelId = "D9BFB1A1-9036-4627-83B2-BBD9983AC8A1"

    keywordQuery.RowLimit = 200;


    ResultTableCollection resultTableCol = keywordQuery.Execute();
    ResultTable resultTable = resultTableCol[ResultType.RelevantResults];

    var resultsDataTable = new DataTable
        TableName = "Results"

    resultsDataTable.Load(resultTable, LoadOption.OverwriteChanges);
    return resultsDataTable;

Insert a Search Results web part.

Edit the web part, click Change Query. In the Select a Query dropdown, select Local People Results (System). In the Query Text box, enter contentclass=people. Go to the Test tab to make sure that your query will populate the results you're looking for, then save everything.

People Search

You can also add additional filters, if you'd like. You can also add refiners, and sort. Just play around with the setting a bit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.