function retrieveListItems()
{
clientContext = new SP.ClientContext.get_current();
//oWeb = clientContext.get_web();
//oLists = oWeb.get_lists();
//clientContext.load(oLists, 'Include(Title, Id)');
//oList = oLists.getByTitle("OrgChart");
oList = clientContext.get_web().get_lists().getByTitle('OrgChart');
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml(
'
'
' + '
' );
oListItems = oList.getItems(camlQuery);
clientContext.load(oListItems);
clientContext.executeQueryAsync(
Function.createDelegate(this,this.onListSuceeded),
Function.createDelegate(this, this.onListFailed)
);
}
function onListSuceeded(sender, args)
{
alert("onListSuceeded");
var EnumerateListItems = oListItems.getEnumerator();
while (EnumerateListItems.moveNext())
{
var oListItem = EnumerateListItems.get_current();
var assignedToVal = oListItem.get_item('Name');
var userName = "";
if (assignedToVal != null)
userName = assignedToVal.get_lookupValue();
alert(userName);
}
}
No comments:
Post a Comment