Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

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");
share|improve this answer

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.

share|improve this answer
    
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 Apr 28 '10 at 13:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.