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?