I need to query the entire user profile store and do multiple operations such as filtering based on one user profile property, sorting by another, and grouping on yet another. Is this possible using any client side API (CSOM/JSOM, REST, SOAP)?

If client side won't work for this situation, is it possible to write all the user profile data into a SharePoint list on a monthly timer job with SSOM or PowerShell? My requirement is to reduce server side coding whenever possible and to allow Power Users the ability to manipulate the display of this data down the road without needing Visual Studio.

This is on SharePoint Server 2013 Standard (so the Content Search Web Part is out of the question since it's not Enterprise).

2 Answers 2


For a client solution I would use the Search REST API. The grouping has to be done on the client, it depends on how you configure your Managed Properties. The trick with People is to pass the correct Result Source ID in the query:

For example:


Returns all users with a last name starting with "m" and returns the Properties LastName, FirstName, WorkEmail, JobTitle, etc. The SourceId parameter tells search to only return People.

  • Can't use search as it's SP Server Standard
    – Josey
    Feb 19, 2014 at 16:20
  • SharePoint Server Standard and Enterprise have the exact same search features. Have you configured the Search Service Application? (Or do you mean that you are using Foundation?) Feb 20, 2014 at 18:20
  • There are differences in search features between standard and enterprise (5 total but the biggest is lack of CSWP on Standard) but regardless, I think you are right in that search based REST might work for this situation. I'll POC it and let you know.
    – Josey
    Feb 21, 2014 at 21:32
  • OK, if you look at it that way there are, like Video Result Sources, etc. But nothing that should impact your search results. Feb 22, 2014 at 12:31
  • I wanted to update you on my POC. So the engineer on this project did not configure search to crawl people so REST will not work in this case. Additionally he didn't use any search templates so tweaking a search results web part's display templates will not work either... damit
    – Josey
    Mar 3, 2014 at 14:50

Schedule a PowerShell script task schedule which goes through all the user profiles and writes to SharePoint List. You can also use PowerShell to perform ordering and sorting on the objects returned.

Note: the script below loops through all the user profiles, you can complete it by writing it your SharePoint List + Scheduling it as a Task.

 #Add SharePoint PowerShell SnapIn if not already added 
    if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) { 
        Add-PSSnapin "Microsoft.SharePoint.PowerShell" 

    $site = new-object Microsoft.SharePoint.SPSite("http://WebapplicationURL/");  
    $ServiceContext = [Microsoft.SharePoint.SPServiceContext]::GetContext($site);  

    #Get UserProfileManager from the My Site Host Site context 
    $ProfileManager = new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($ServiceContext)    
    $AllProfiles = $ProfileManager.GetEnumerator()  

    foreach($profile in $AllProfiles)  
        $DisplayName = $profile.DisplayName  
        $AccountName = $profile[[Microsoft.Office.Server.UserProfiles.PropertyConstants]::AccountName].Value  

        #Here goes writing Logic to your SharePoint List + Check if account already existing in the SharePoint list then ignore writing.......
        write-host "Profile for account ", $AccountName 

    write-host "Finished." 
  • This won't work client side. It has to be run on the server. Feb 19, 2014 at 11:44
  • My bad, I thought he said it was fine to run the PowerShell on server side. Feb 20, 2014 at 9:51
  • No, no! My bad, I totally skipped the section that says PowerShell is OK. Sorry! Feb 20, 2014 at 18:18

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.