SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 :|

share|improve this question
1  
Duplicate of sharepoint.stackexchange.com/questions/20802/… ? – eirikb Sep 14 '12 at 13:03
var ctx = new SP.ClientContext();
var user = ctx.get_web().get_currentUser();
ctx.load(user);
ctx.executeQueryAsync(function() {
    console.log(user);
});​
share|improve this answer
    
Slightly different approach than what @vedran-rasol did in sharepoint.stackexchange.com/questions/20802/… – eirikb Sep 14 '12 at 13:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.