How do I go about getting the client username with the javascript client object model? I can't find anything helpful in microsoft's documentation, it's awful :|
Asked
Active
Viewed 3,675 times
0
-
1Duplicate of http://sharepoint.stackexchange.com/questions/20802/get-the-user-id-via-javascript ? – eirikb Sep 14 '12 at 13:03
1 Answers
2
var ctx = new SP.ClientContext();
var user = ctx.get_web().get_currentUser();
ctx.load(user);
ctx.executeQueryAsync(function() {
console.log(user);
});
eirikb
- 7,405
- 5
- 35
- 67
-
Slightly different approach than what @vedran-rasol did in http://sharepoint.stackexchange.com/questions/20802/get-the-user-id-via-javascript – eirikb Sep 14 '12 at 13:07