Retrieve the Created By Field in SharePoint 2013 CSOM

In this Blog, I will explain how to get Created By Column value in SharePoint 2013 using Client Side Object Model. Before we get into the actual implementation, let's see what is created By cloumn and where it is primiarly used.
 
Created By & Modified By columns are "Person or Goup" type columns. In SharePoint all the lists has these columns by default. They are Look up columns as well.
 
To retrieve the values , CSOM 2013 implementation is shown as follows
 

var clientContext = new SP.ClientContext.get_current();

if (clientContext != undefined && clientContext != null) {

var webSite = clientContext.get_web();

this.list = webSite.get_lists().getByTitle("CustomList");

var fieldCreatedBy = this.listItem.get_item("Author");

var fieldModifiedBy = this.listItem.get_item("Editor");

alert("Created By: " + fieldCreatedBy.get_lookupValue());

alert("Modified By: " + fieldModifiedBy .get_lookupValue());

 Happy SharePointing :-)
 
 
 
 
 
 
Ebook Download
View all
Learn
View all