I'm using the User Profile Service Application in SharePoint 2010 which contains imported user profiles.

Now I want to display a list of all users who have a profile, to show a list like "my colleagues". But the Profile Service API doesn't seem to have a way to get all user profiles.

I suspect this is due to performance reasons, but even so, what would be a way to actually retrieve all profiles?

using .AllUsers feels problematic since it doesn't match the list of profiles.

1 Answer 1


This will give you all profiles, without restrictions:

var serviceContext = SPServiceContext.GetContext(site);
var userProfileManager = new UserProfileManager(serviceContext);
foreach (UserProfile userProfile in userProfileManager)
    // ...

This operation in itself is not super costly, but retrieving individual user profile properties can be.

You'll most likely need to elevate while doing this.

  • 1
    Does this get you the user profile from the site collection (user information list) "site" that you pass into "SPServiceContext.GetContext" or does it come from the central User Profile DB that the "User Profile Service Application uses"? I'm hoping that it is the latter but then why would you need to pass in a site collection for context if it's universal to all site collections?
    – skeletank
    Jun 11, 2012 at 18:48
  • I have testet it and I can say that it comes from the central User Profile DB :)
    – lex
    Jul 29, 2013 at 9:13

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.