views:

39

answers:

1

I'm attempting to iterate through all User Profiles in SharePoint 2010 from a Silverlight application that will be added to a SharePoint page. Based on what I've learned, the User Profile Service is different than the SharePoint Website's store of a list of users who are "members" of the site or have ever visited it. To get that list of users, see this question.

I know about the asmx web service that SharePoint 2010 provides at mysite.com/_vti_bin/UserProfileService.asmx, but that doesn't seem to have anything like a GetAllUserProfiles method. The closest it looks like I can get is by iterating through all users with successive calls to the GetUserProfileByIndex method, but that's far from optimal.

Is there a way to access User Profiles via a built-in Sharepoint 2010 REST-ful service, such as what's provided for site links at mysite.com/_vti_bin/listdata.svc/Links? If not, what approach do you recommend to get all existing User Profiles in SharePoint 2010?

EDIT:

The purpose of this is to provide summary profile information in the Silverlight control. For example, showing the User Profiles that have the most "Interests" set in their profile. This task is only possible by iterating through all User Profiles.

+2  A: 

Are you sure you want to do this through a web service? Getting all links for a user means 20 simple urls. Getting all user profiles means 20,000 large complex objects.

Iterating through all profiles is something I have done in import code, but outside of that I can't think of a scenario where it wouldn't make more sense to use search - especially when user interaction is involved.

Tom Clarkson
See my edit to the question -- I just want to get all User Profile data through one URL and one request. Is that possible? Once retrieved, the data can be cached, so I don't think the complexity and size of the objects will be a major issue.
ChessWhiz
I don't think there is a built in service for it, because in general it is a really bad idea. The best option for the task you describe is some custom code running on the server that finds the appropriate records before sending them to the client. Even then straight iteration over profile records isn't really performant enough for user interaction - you may need to do something like adding a calculated interestcount field to the profile that can then be searched on. Server side caching may help, but downloading the entire user profile store to the client is definitely not the right approach.
Tom Clarkson
Great, thanks for your insight.
ChessWhiz