Share your content and reach out to more developers by submitting them at - Developer Community Site

Getting the User’s Last Name in Windows 10 Apps using JavaScript

Below is a sample JavaScript code snippet demonstrating how to get the user’s last Name from the Windows 10 Universal Windows Platform App using WinJS.

How to Get the User’s last Name in Windows 10 Apps using JavaScript ?

function getUserlastNameAC() {
    if (Windows.System.UserProfile.UserInformation.nameAccessAllowed) {
        Windows.System.UserProfile.UserInformation.getLastNameAsync().done(function (data) {
            if (data) {
               return data;
    } else {
        return "Last Name cannot be accessed because this functionality is disabled by Privacy Setting or Group Policy in Windows 10";

Leave Your Comment