Skip to content

Instantly share code, notes, and snippets.

@spdustin
Created October 31, 2012 16:44
Show Gist options
  • Save spdustin/3988182 to your computer and use it in GitHub Desktop.
Save spdustin/3988182 to your computer and use it in GitHub Desktop.
Temp - Get Current User Info
function getUserInfo() {
var ctx = new SP.ClientContext.get_current();
var web = ctx.get_web();
this.usr = web.get_currentUser();
ctx.load(this.usr);
ctx.executeQueryAsync(
Function.createDelegate(this, this.getUserInfo_success),
Function.createDelegate(this, this.getUserInfo_failure)
);
}
function getUserInfo_success(sender, args) {
console.log(this.usr.get_principalType());
}
function getUserInfo_failure(sender, args) {
console.error("Whoops. Can't get user info");
}
getUserInfo();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment