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