Created
October 31, 2012 16:44
-
-
Save spdustin/3988182 to your computer and use it in GitHub Desktop.
Temp - Get Current User Info
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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