SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In the SharePoint 2010 User Profile Service API there is a method to get the manager of an employee by using the method UserProfile.GetDirectReports().

I would like to do the same for these 2 properties:

  • SPS-Dotted-line (Dotted-line Manager)
  • Dotted-line-2 (Dotted Line Manager 2) *this is a custom property

How do I do it?

share|improve this question
up vote 0 down vote accepted

Any of the user properties can be read or updated in code. They took a few of the properties that they use frequently and put a dedicated method available to make it easier for them to get the value.

Something like this should work....

        using (SPSite site = new SPSite(url) 
            SPServiceContext context = SPServiceContext.GetContext(site);
            UserProfileManager profileManager = new UserProfileManager(context);

            UserProfile profile = profileManager.GetUserProfile(this.User);
            string dottedMgr = profile[propName].ToString();
share|improve this answer
Thanks Mike, just to make it clear my question is not about getting or updating a user profile. It's about given an employee I can get his/her manager using the UserProfile.GetDirectReports(); method provided by the User Profile Service API. Now, is there any way for me to do the same for other property. – Agamand The True Sep 22 '11 at 2:08
There is no defined method that pulls that specific field, you would use the code above to read any of the other configured properties including the dotted line manager or your custom field. – Mike Oryszak Sep 22 '11 at 3:51
Thanks again Mike, I have one last question.So I have to load all the user profile and check one by one. Wow, thats gonna hurt the page loading time very badly. Do you have any technique or idea how to do the checking without hurting the page loading so much. – Agamand The True Sep 23 '11 at 8:30
The GetUserProfile() method loads the profile xml for a single user. That should not take a long time unless you have significant data stored in there. The call should be sub-second. – Mike Oryszak Sep 23 '11 at 12:29

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.