Getting the Account Display Name in Windows 10 Apps using JavaScript

Published on June 14, 2015 by abundantcode

Filed under JavaScript

Last modified June 14, 2015

Print this page

rate 1 star rate 2 star rate 3 star rate 4 star rate 5 star
Your rating: none, Average: 0 (0 votes)

This article have been viewed 6389 times

Below is a sample JavaScript code snippet demonstrating how to get the account display name from the Windows 10 Universal Windows Platform App using WinJS.

How to Get the Account Display Name in Windows 10 Apps using JavaScript ?

 function returnDisplayNameAC() {
// Check if the privacy settings in Windows 10 allows the apps to get the name
        if (Windows.System.UserProfile.UserInformation.nameAccessAllowed) {
            Windows.System.UserProfile.UserInformation.getDisplayNameAsync().done(function (returnData) {
                if (returnData) {
                    return returnData;
                } 
            });
        } else {
            return "Access to name is disabled by Privacy Setting or Group Policy of your Windows";
        }
    }

1 Comment

  1. Getting the User First Name in Windows 10 Apps using JavaScript | Abundant Code
    June 14, 2015 - 3:00 pm

Leave a Comment


x

You might be Interested in these Posts

How to delete user account from command line in Windows 10 ?

You can delete a user account from command line in Windows 10 using the net user command and specify...

How to add new user account from command line in Windows 10 ?

You can add a new user account in Windows 10 using command prompt using the net user command and pas...

How to open display settings from command line in Windows 10 ?

The display properties can be found in the settings app in Windows 10 which lets the users to config...