1

In MOSS 2007 this was straight forward. Instantiate a UserProfileManager and retrieve your own profile.

In 2010 it seems the user has to have specific access to the user profile service. Even to access his own profile from a webpart?!

I just want to extract one simple property from the user's profile. How hard is that supposed to be in this version?

2 Answers 2

3

The UserProfileManager is available in the OM. Below is some code to access it and get a users profile. So are you getting an error when trying to get someone elses profile? If so you may want to run with elevated privileges and make sure the application pool account has been granted permissions to the User Profile Service Application in central admin under "Manage Service Applications".

SPServiceContext context = SPServiceContext.GetContext(SPServiceApplicationProxyGroup.Default, 
            SPSiteSubscriptionIdentifier.Default);

        UserProfileManager upm = new UserProfileManager(context, true);
        UserProfile up = upm.GetUserProfile("basesmc2008\\steve.curran");
0

I haven't noticed the changes there yet, but I know the userprofileservice is still available and widely used. The GetUserProfileByName method will grab the user's profile.

1
  • The userprofileservice is indeed still there, but it feels pretty redundant to have to make an asmx web service call when you're already on the server. I really don't understand why this isn't part of the object model.
    – Anonymous
    Commented Apr 28, 2010 at 13:56

Your Answer

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