Thursday, December 29, 2011

Retrieve all user in SharePoint 2010 site using Javascript client object model

function GetAllUsers()
{
var clientContext = new SP.ClientContext.get_current();
var web = clientContext.get_web();
var userInfoList = web.get_siteUserInfoList();
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml(‘’ +’’ + userID + ‘’ +
1
’);
this.collListItem = userInfoList.getItems(camlQuery);
clientContext.load(collListItem);
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded),Function.createDelegate(this, this.onQueryFailed));
}
function onQuerySucceeded(sender, args)
{
var item = collListItem.itemAt(0);
var profileNotes = item.get_item(‘Notes’);
alert(profileNotes);
}
function onQueryFailed(sender, args)
{
}
}

No comments:

Post a Comment