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

I'm using the SharePoint 2010 Client Object Model to retrieve all the users from a SharePoint instance, via Web.SiteUserInfoList:

var query = new CamlQuery { ViewXml = "<Query/>" };
var userDetails = clientContext.Web.SiteUserInfoList.GetItems(query);
clientContext.Load(userDetails);
clientContext.ExecuteQuery();

This works great in our test environment, and in their test environment.

However, in their prod environment, a number of fields one would expect to see on the ListItems in userDetails are not part of the FieldValues dictionary:

  • FirstName
  • LastName
  • Office
  • SPSResponsibility
  • UserName
  • WebSite
  • WorkPhone

A number of these are blank anyway, but WorkPhone was expected and the app crashed when the key wasn't even present in the dictionary.

This field is actually present in the SharePoint instance; I can see the values if i view the My profile pages for the users, and I can see it listed in User Profile Service Application's "Manage User Properties" page. It just isn't being included in the FieldValues dictionary when I query SiteUserInfoList.

I was thinking maybe there was a default view for that list or something that for some reason didn't include those fields in one of the environments, but I'm not sure how I would even find and alter that view. I don't want to specify a long and complicated CamlQuery string if I can avoid it (and I'm not sure if that would even expose the fields, depending on why they're missing).

Suggestions?

share|improve this question

3 Answers 3

In case anyone else is trying to understand why the missing fields: I'm sure you'll find that they are due to feature differences between SharePoint Foundation / Standard / Enterprise. SPF does not have the fields you mention on the SiteUserInfoList, where SPS does.

A good quick reference to which fields are available in which version:

SPServices: $().SPServices.SPGetCurrentUser

I've not actually been able to find an official list of differences anywhere, anyone?

share|improve this answer

Try to fetch Xml of the list item & see are these properties are accessed ..... if so you can easily parse the xml else you have to can try to sync the the the SiteUserInfo Hidden list with the user profile service application & you can also try Web.EnsureUser in Object Model in a loop "it has advantage that it will insert/Update the userinfolist with user entry"

share|improve this answer

Yes, this is problematic.

In SP 2007, we had been using the "Lookup site user property" workflow action from Codeplex to lookup the UserName property for various purposes in the workflow. But apparently the UserName property for SharePoint 2010 no longer reliably returns a username. For some users this is now empty.

But the Name property never seems to be empty. Name returns DOMAIN/username. So in our workflows we have replaced looking up the UserName property with looking up the Name property and then stripping out the domain by using the "Extract substring from index of string" action afterwards. In our case the domain is 4 characters, so we start extracting at 6.

share|improve this answer

Your Answer

 
discard

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.