Windows Dev Center

UserInformation class

Gets or sets information about the user, such as name and account picture.

Syntax


var userInformation = Windows.System.UserProfile.UserInformation;

Members

The UserInformation class has these types of members:

Events

The UserInformation class has these events.

EventDescription
AccountPictureChanged Occurs when the user's image or name changes.

 

Methods

The UserInformation class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

MethodDescription
GetAccountPicture Gets the account picture for the user.
GetDisplayNameAsync Gets the display name for the user account.
GetDomainNameAsync Gets the domain name for the user.
GetFirstNameAsync Gets the user's first name.
GetLastNameAsync Gets the user's last name.
GetPrincipalNameAsync Gets the principal name for the user. This name is the User Principal Name (typically the user's address, although this is not always true.)
GetSessionInitiationProtocolUriAsync Gets the Uniform Resource Identifier (URI) of the session initiation protocol for the user.
SetAccountPictureAsync Sets the picture for the user's account using an IStorageFile object.
SetAccountPictureFromStreamAsync Sets the picture for the user's account using an IRandomAccessStream object.
SetAccountPicturesAsync Sets the pictures for the user's account using an IStorageFile object. Supports adding a small image, large image, and video.
SetAccountPicturesFromStreamsAsync Sets the pictures for the user's account using an IRandomAccessStream object. Supports adding a small image, large image, and video.

 

Properties

The UserInformation class has these properties.

PropertyAccess typeDescription

AccountPictureChangeEnabled

Read-onlyDetermines if the user's account picture can be changed.

NameAccessAllowed

Read-onlyAllows you to see if your app is allowed to access the user's information.

 

Remarks

To be launched in account picture mode and to set the user's picture without additional prompting, an app must register as an account picture provider by including the following in the Extensions section of the app manifest.


<Extension Category="windows.accountPictureProvider" />

Examples


function getUserInfo() {
    image = Windows.System.UserProfile.UserInformation.getAccountPicture(Windows.System.UserProfile.AccountPictureKind.smallImage);
    imageURL = URL.createObjectURL(image, false);
}    

Requirements (Windows 10 device family)

Device family

Desktop

API contract

Windows.System.UserProfile.UserProfileContract, introduced version 1.0

Namespace

Windows.System.UserProfile
Windows::System::UserProfile [C++]

Metadata

Windows.System.UserProfile.UserProfileContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8 [Windows Store apps, desktop apps]

Minimum supported server

Windows Server 2012 [Windows Store apps, desktop apps]

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.System.UserProfile
Windows::System::UserProfile [C++]

Metadata

Windows.winmd

Attributes

[DualApiPartition()]
[Version(0x06020000)]

See also

Object

 

 

Show:
© 2015 Microsoft