MSDN Library
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

UserInformation class

Represents information about the user, such as name and account picture.

Important  The UserInformation class is not supported on Windows 10 or later. Use the User class instead. See Remarks.
 

Syntax


public ref class UserInformation abstract sealed 

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-only

Determines if the user's account picture can be changed.

NameAccessAllowed

Read-only

Allows you to see if your app is allowed to access the user's information.

 

Remarks

Important  The UserInformation class is not supported on Windows 10 or later. Use the User class instead.
 

Windows 10:  

Apps compiled for Windows 8 that use the UserInformation class no longer return user information when running on Windows 10. This is because in Windows 10, apps do not have access to user information without explicit user consent, unlike in Windows 8 where this permission is granted by default.

If you have a Windows 8 app that uses the UserInformation class, you should migrate your app to the Universal Windows Platform (UWP) and access the User class instead. Universal Windows Platform (UWP) apps that access user information are now expected to declare a new capability, uap:userAccountInformation, and call new APIs, Windows.System.User.FindAllAsync and User.GetPropertiesAsync, to get the data.

Users installing the app are prompted to allow access to their user information. If the user allows the app to access the information, the app appears listed in the Privacy page of the Windows 10 Settings UI (Settings > Privacy > Account info). This allows Windows 10 users to enable access to user information on a per-app basis.

Windows 8:  

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, introduced version 10.0.10240.0
Mobile, introduced version 10.0.10240.0

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
User

 

 

Show:
© 2016 Microsoft