0

So I can use the PeopleManager to get a user's profile but I can't figure out how to get the correct ID I need in order to add a new list item to a list and populate a look-up type field with that specific user's information.

After an item is inserted I can get that value using the FieldUserValue but how do I determine it before?

This is using COM in C# and SharePoint 2013 Online.

1 Answer 1

0

From a COM solution you can fetch data of the User's only by

/site/test/_vti_bin/userprofileservice.asmx
web service. So you can user the following code to fetch data:


  UserProfileService tmpUserProfileService = new UserProfileService();
  tmpUserProfileService.Credentials = new NetworkCredential("ADMIN", "PASSWORD", "DOMAIN");
  PropertyData[] properties =tmpUserProfileService.GetUserProfileByName(@"DOMAIN\USER");            
  for (int i = 0; i < properties.Length; i++)
  {
       Console.WriteLine(properties[i].Name);
       Console.WriteLine(properties[i].Value);
  }
  Console.Read();

Reference: User Profile Server

1
  • I can already do that in COM to get a person's profile but there is no ID field for me to grab in order to set a field (say creating a new list item) to be a specific person in a person picker field. I've tried using the ID I have, which isn't a domain\user its something else (this is sharepoint online) It seems I can set a person picker type field in a list using only this ID, I've tried using the GUIDs, the ID I use to get the profile, and some other stuff. Maybe I am going abot trying to set that field when I create a new list item wrong?
    – Bigbacon
    Aug 11, 2014 at 13:59

Your Answer

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

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