Skip to content

Instantly share code, notes, and snippets.

@vgrem
Created November 9, 2014 11:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save vgrem/1378dfb19748b04d4525 to your computer and use it in GitHub Desktop.
Save vgrem/1378dfb19748b04d4525 to your computer and use it in GitHub Desktop.
function getListAuthor(listTitle,OnSuccess,OnError) {
getListProperties(listTitle,
function(listJson){
var context = SP.ClientContext.get_current();
var listAuthor = context.get_web().getUserById(listJson.Author);
context.load(listAuthor);
context.executeQueryAsync(
function(){
OnSuccess(listAuthor);
},OnError);
},
OnError);
}
//Usage
getListAuthor('Discussion Board',
function(author){
console.log('List created by: ' + author.get_loginName());
},
function(sender,args){
console.log('Error occured:' + args.get_message());
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment