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

I have a dynamically created array of user logins, I would like to retrieve information about these users through CSOM. I found this great post, but there is explanation how to retrieve all users from group. How can I specify that I need to retrieve info only for users in my array?

share|improve this question
up vote 1 down vote accepted

For my project I used User Information List, but I don't think that it is a good solution

var peoplePicker = SPClientPeoplePicker.SPClientPeoplePickerDict[clientId + "_TopSpan"];
var users = peoplePicker.GetAllUserInfo();

var _ctx = new SP.ClientContext(_spPageContextInfo.webAbsoluteUrl);

var expressions = new Array();
for (var i = 0; i < users.length; i++) {
    expressions.push("<Eq><FieldRef Name='Name' /><Value Type='Text'>" + users[i].Key + "</Value></Eq>");

var query = new SP.CamlQuery();
query.set_viewXml("<View><Query><Where>" + buidQueryFromExpressions(expressions) + "</Where></Query></View>");

var list = _ctx.get_web().get_siteUserInfoList();

_loadUsers = list.getItems(query);

share|improve this answer
Trying to do this very thing but in JSOM...for an Office 365 app, great post. – Stephen Jan 9 '14 at 19:46
When i run this i get an error buidQueryFromExpressions is not defined, is this because you are using CSOM and I'm JSOM? – Stephen Jan 9 '14 at 19:54
@Stephen, no. It is a custom function which combine expressions with <or> tag. – Alexander Jan 10 '14 at 8:09

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.