Example -
var context = new SP.ClientContext.get_current();
var web = context.get_web();
var list = web.get_lists().getByTitle('Testlist');
var query = '<query><where><isnotnull><fieldref lookupid="TRUE" name="CheckoutUser"> </fieldref></isnotnull></where></query>'
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml(query);
allItems = list.getItems(camlQuery);
context.load(allItems);
context.executeQueryAsync(Function.createDelegate(this, this.success), Function.createDelegate(this, this.failed));
function success()
{
var TextFiled = "";
var ListEnumerator = this.allItems.getEnumerator();
while(ListEnumerator.moveNext())
{
var currentItem = ListEnumerator.get_current();
TextFiled += currentItem.get_item('Title')+ 'Checked Out to' + currentItem.get_item('CheckoutUser') '\n';
;
}
alert(TextFiled);
}
function failed(sender, args) {
alert("failed. Message:" + args.get_message());
}
Ads by Google
No comments:
Post a Comment