1

I'm writing a polling app for Sharepoint 2013. I created a custom list and need to save the user's vote for each poll.

How do I pass in the Active Directory Name into a label control on the app?

3
  • AD name? Will the spuser be enough? then you can use the currentuser from web context – Burrhus Feb 16 '14 at 9:55
  • 1
    You get all you need from the user object. If you don't like to code you can simply use a survey list that does the same as your application. – Stefan Bauer Feb 16 '14 at 13:42
  • @Burrhus Can you elaborate further in an answer? – SidC Feb 16 '14 at 23:33
1

Something like this.

this.currentContext = new SP.ClientContext.get_current();

this.currentUser = this.currentContext.get_web().get_currentUser();

this.currentContext.load(this.currentUser);

this.currentContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));

onQuerySucceeded = function () {
        var intCount = 1;
        $(".ms-inputuserfield").html(this.currentUser.get_loginName());        
};

The code isn't tested but you get the idea I think.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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