Tag Archives: how to get logged

How to get current user id and name in Sharepoint 2013 using Ecma Script

var userid; function GetUserDetails() { clientContext = new SP.ClientContext.get_current(); var oWeb = clientContext.get_web(); currentUser = oWeb.get_currentUser(); clientContext.load(currentUser); clientContext.executeQueryAsync(function () { userid = currentUser.get_id(); usertitle = currentUser.get_title(); }, function (error) { alert(‘Request failed: ‘); }); } Advertisements

Posted in Uncategorized | Tagged , , , , , , , | Leave a comment