0

I am able to get data from 'PreferredName', 'WorkEmail' properties etc. but I cannot get any value to return when I query "Manager" property.

Any idea why?

I had the same issue when I wanted to pull the user's Job Title. I asked for "Title" which did not populate. I checked the SQL table to find a secondary value listed under SPS-JobTitle. I put that in my form and the user title populated. I'm wondering if "Manager" is the same way?

I'm just not having any luck. This is the only value I need to complete my project.

2
  • Manager is the correct Name of the property if you want to pull managers of a user. Can you post your code please. Also possible for the user Manager has not been set in profile.
    – Asad Refai
    Aug 11, 2015 at 7:01
  • 1
    Hi Ransher, I'm using rules in Infopath and am not writing code.
    – Dustin
    Aug 11, 2015 at 13:14

1 Answer 1

-1

Assuming that you have already mapped manager field and getting issues on reading these values. As manager field type is not string type you need to cast this value to string.
Go through this code you will get an idea, to read User Profile property.

 var serviceContext = SPServiceContext.GetContext(site);
 var userProfileManager = new UserProfileManager(serviceContext);
 foreach (UserProfile userProfile in userProfileManager)
  {
  UserProfile u = userProfileManager.GetUserProfile("Domain\\username");
  string strManagerName = u["Manager"].Value as string;
  }
3
  • Can you tell me where I would put this code to change the field type?
    – Dustin
    Aug 11, 2015 at 13:15
  • Any update as to where to put this code?
    – Dustin
    Aug 13, 2015 at 20:37
  • Sorry, @Dustin i am not aware of infopath form coding. But if you want to read values using Visual Studio web part i can help you. Aug 14, 2015 at 6:29

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.