UserInformation UserInformation UserInformation UserInformation UserInformation Class

Definition

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.

public : static class UserInformation
static struct winrt::Windows::System::UserProfile::UserInformation
public static class UserInformation
Public Static Class UserInformation
// This class does not provide a public constructor.
Attributes
Windows 10 requirements
Device family
Windows Desktop Extension SDK (introduced v10.0.10240.0) Windows Mobile Extension SDK (introduced v10.0.10240.0)
API contract
Windows.System.UserProfile.UserProfileContract (introduced v1)

Examples

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

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) app 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.

When users install the app, they 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.

You can also enable access to user information without additional code modification by deploying a group policy change, which is particularly useful for business and enterprise customers. To allow access to user information on Windows 10, enable the following group policy setting and set it to "Always On": Computer Configuration > Administrative Templates > System > User Profiles > User management of sharing user name, account picture, and domain information with apps (not desktop apps). For more info, download Group Policy Settings Reference for Windows and Windows Server.

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.

Properties

AccountPictureChangeEnabled AccountPictureChangeEnabled AccountPictureChangeEnabled AccountPictureChangeEnabled AccountPictureChangeEnabled

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

Important

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

NameAccessAllowed NameAccessAllowed NameAccessAllowed NameAccessAllowed NameAccessAllowed

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

Important

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

Methods

GetAccountPicture(AccountPictureKind) GetAccountPicture(AccountPictureKind) GetAccountPicture(AccountPictureKind) GetAccountPicture(AccountPictureKind) GetAccountPicture(AccountPictureKind)

Gets the account picture for the user.

Important

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

GetDisplayNameAsync() GetDisplayNameAsync() GetDisplayNameAsync() GetDisplayNameAsync() GetDisplayNameAsync()

Gets the display name for the user account.

Important

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

GetDomainNameAsync() GetDomainNameAsync() GetDomainNameAsync() GetDomainNameAsync() GetDomainNameAsync()

Gets the domain name for the user.

Important

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

GetFirstNameAsync() GetFirstNameAsync() GetFirstNameAsync() GetFirstNameAsync() GetFirstNameAsync()

Gets the user's first name.

Important

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

GetLastNameAsync() GetLastNameAsync() GetLastNameAsync() GetLastNameAsync() GetLastNameAsync()

Gets the user's last name.

Important

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

GetPrincipalNameAsync() GetPrincipalNameAsync() GetPrincipalNameAsync() GetPrincipalNameAsync() 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.)

Important

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

GetSessionInitiationProtocolUriAsync() GetSessionInitiationProtocolUriAsync() GetSessionInitiationProtocolUriAsync() GetSessionInitiationProtocolUriAsync() GetSessionInitiationProtocolUriAsync()

Gets the Uniform Resource Identifier (URI) of the session initiation protocol for the user.

Important

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

SetAccountPictureAsync(IStorageFile) SetAccountPictureAsync(IStorageFile) SetAccountPictureAsync(IStorageFile) SetAccountPictureAsync(IStorageFile) SetAccountPictureAsync(IStorageFile)

Sets the picture for the user's account using an IStorageFile object.

Important

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

SetAccountPictureFromStreamAsync(IRandomAccessStream) SetAccountPictureFromStreamAsync(IRandomAccessStream) SetAccountPictureFromStreamAsync(IRandomAccessStream) SetAccountPictureFromStreamAsync(IRandomAccessStream) SetAccountPictureFromStreamAsync(IRandomAccessStream)

Sets the picture for the user's account using an IRandomAccessStream object.

Important

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

SetAccountPicturesAsync(IStorageFile, IStorageFile, IStorageFile) SetAccountPicturesAsync(IStorageFile, IStorageFile, IStorageFile) SetAccountPicturesAsync(IStorageFile, IStorageFile, IStorageFile) SetAccountPicturesAsync(IStorageFile, IStorageFile, IStorageFile) SetAccountPicturesAsync(IStorageFile, IStorageFile, IStorageFile)

Sets the pictures for the user's account using an IStorageFile object. Supports adding a small image, large image, and video.

Important

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

SetAccountPicturesFromStreamsAsync(IRandomAccessStream, IRandomAccessStream, IRandomAccessStream) SetAccountPicturesFromStreamsAsync(IRandomAccessStream, IRandomAccessStream, IRandomAccessStream) SetAccountPicturesFromStreamsAsync(IRandomAccessStream, IRandomAccessStream, IRandomAccessStream) SetAccountPicturesFromStreamsAsync(IRandomAccessStream, IRandomAccessStream, IRandomAccessStream) SetAccountPicturesFromStreamsAsync(IRandomAccessStream, IRandomAccessStream, IRandomAccessStream)

Sets the pictures for the user's account using an IRandomAccessStream object. Supports adding a small image, large image, and video.

Important

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

Events

AccountPictureChanged AccountPictureChanged AccountPictureChanged AccountPictureChanged AccountPictureChanged

Occurs when the user's image or name changes.

Important

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

See Also