I am trying to find the Author Name(created by) for a given Item Id using the SP Client context in SharePoint 2010.
Below the code snippet
var ctx = new SP.ClientContext.get_current();
//this.web = ctx.get_web().get_lists().getByTitle(;
var query = new SP.CamlQuery();
var queryStr = "<View><Query><Where><Eq><FieldRef Name=\'Series\' /><Value Type=\'Choice\'>Sample</Value></Eq></Where></Query></View>";
alert( queryStr );
query.viewXml = queryStr;
var list = ctx.get_web().get_lists().getByTitle('PKS Podcasts');
listItems = list.getItems(query);
ctx.load(listItems);
ctx.executeQueryAsync(Function.createDelegate(this, this.onSuccess), Function.createDelegate(this, this.onFail));
}
function onSuccess(sender, args) {
var listEnumerator = listItems.getEnumerator();
while (listEnumerator.moveNext()) {
alert("Item containing ‘announce’ found! \nTitle: " + listEnumerator.get_current().get_item("Author"));
}
}
function onFail(sender, args) {
alert('failed to get list. Error:'+args.get_message());
}
But it is returning the object and not able to get the Author name...is there a way to find the same?
