I am able to get items from a list using CSOM/JSOM using JavaScript and it seems to pull in the Created By (Author) value but it does not seem to pull the Modified By (Editor) value.
How can I get the Modified By (Editor) value also?
ExecuteOrDelayUntilScriptLoaded(function()
{
var context = new SP.ClientContext.get_current()
var list = context.get_web().get_lists().getByTitle("test");
var view = list.get_views().getByTitle("All Items");
context.load(view);
context.executeQueryAsync(Function.createDelegate(this, function(sender, args)
{
var query = new SP.CamlQuery();
query.set_viewXml("<View><Query>" + view.get_viewQuery() + "</Query></View>");
var items = list.getItems(query);
context.load(items);
context.executeQueryAsync(Function.createDelegate(this, function(sender, args)
{
var listEnumerator = items.getEnumerator();
while(listEnumerator.moveNext())
{
var listItem = listEnumerator.get_current();
// this works
var createdBy = listItem.get_item("Author");
// THIS DOES NOT WORK
// THIS DOES NOT WORK
// THIS DOES NOT WORK
// THIS DOES NOT WORK
// THIS DOES NOT WORK
var createdBy = listItem.get_item("Editor");
}
}), Function.createDelegate(this, function(){}));
}), Function.createDelegate(this, function(){}));
}, "sp.js");
createDelegatebloats your code and is old IE8 code: sharepoint.stackexchange.com/questions/164893/…