Getting the User First Name in Windows 10 Apps using JavaScript

Published on June 14, 2015 by Senthil Kumar

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: 2 (2 votes)

This article have been viewed 17059 times

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

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

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

1 Comment

  1. Getting the User’s Last Name in Windows 10 Apps using JavaScript | Abundant Code
    June 14, 2015 - 4:18 pm

Leave a Comment


You might be Interested in these Posts

ES6: The future is now at Warrington on October 18 , 2016

JavaScript North West User Group is hosting its user group meet on the topic "ES6: The future i...

How to append an array to another in JavaScript ?

In JavaScript , you may want to append one array to another array(s) to combine their elements resul...

How to pass a function as parameter in JavaScript ?

There are times when you might want to pass a function as argument to another function in JavaScript...