Current User Display Name

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
Stu
Posts: 23
Joined: Tue May 10, 2016

10 Aug 2016

How do you get the current users Display name?

Thanks

Stuart

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

11 Aug 2016

Hi Stu,

Please, use the code:

Code: Select all

SP.SOD.executeOrDelayUntilScriptLoaded((function () { 
    var ctx = new SP.ClientContext.get_current(); 
    var web = ctx.get_web(); 
    ctx.load(web); 
    var user = web.get_currentUser(); 
    user.retrieve(); 
    ctx.executeQueryAsync( 
    function () { 
      alert(user.get_title());
    }); 
}), "SP.js"); 

Stu
Posts: 23
Joined: Tue May 10, 2016

11 Aug 2016

Thanks it worked perfectly

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 5 guests