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

Declaration

public static class UserInformationpublic static class UserInformationPublic Static Class UserInformation

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, FindAllAsync(Windows.System.UserType,Windows.System.UserAuthenticationStatus) and GetPropertiesAsync(Windows.Foundation.Collections.IVectorView{System.String}), 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.

Examples

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

Properties summary

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.

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 summary

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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 summary

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.

Properties

Methods

  • GetAccountPicture(Windows.System.UserProfile.AccountPictureKind)
    GetAccountPicture(Windows.System.UserProfile.AccountPictureKind)
    GetAccountPicture(Windows.System.UserProfile.AccountPictureKind)
    GetAccountPicture(Windows.System.UserProfile.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.

    public static IStorageFile GetAccountPicture(Windows.System.UserProfile.AccountPictureKind kind)public static IStorageFile GetAccountPicture(Windows.System.UserProfile.AccountPictureKind kind)Public Static Function GetAccountPicture(kind As Windows.System.UserProfile.AccountPictureKind) As IStorageFile

    Parameters

    Returns

    Remarks

    Important

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

    Access to the account picture can be blocked by privacy settings (for example, if the NameAccessAllowed property is false). If access is blocked, this method returns a null value.

    This method does not throw an exception.

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

    public static IAsyncOperation<string> GetDisplayNameAsync()public static IAsyncOperation<string> GetDisplayNameAsync()Public Static Function GetDisplayNameAsync() As IAsyncOperation( Of string )

    Returns

    • The display name for the user account.

    Remarks

    Important

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

    Access to the display name can be blocked by privacy settings (for example, if the NameAccessAllowed property is false). If access is blocked, this method returns an empty string.

    This method does not throw an exception.

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

    public static IAsyncOperation<string> GetDomainNameAsync()public static IAsyncOperation<string> GetDomainNameAsync()Public Static Function GetDomainNameAsync() As IAsyncOperation( Of string )

    Returns

    • A string that represents the domain name for the user.

    Remarks

    Important

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

    Access to the domain name can be blocked by privacy settings (for example, if the NameAccessAllowed property is false). If access is blocked, this method returns an empty string.

    This method does not throw an exception.

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

    public static IAsyncOperation<string> GetFirstNameAsync()public static IAsyncOperation<string> GetFirstNameAsync()Public Static Function GetFirstNameAsync() As IAsyncOperation( Of string )

    Returns

    • The user's first name.

    Remarks

    Important

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

    Access to the user's first name can be blocked by privacy settings (for example, if the NameAccessAllowed property is false). If access is blocked, this method returns an empty string.

    This method does not throw an exception.

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

    public static IAsyncOperation<string> GetLastNameAsync()public static IAsyncOperation<string> GetLastNameAsync()Public Static Function GetLastNameAsync() As IAsyncOperation( Of string )

    Returns

    • The user's last name.

    Remarks

    Important

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

    Access to the user's last name can be blocked by privacy settings (for example, if the NameAccessAllowed property is false). If access is blocked, this method returns an empty string.

    This method does not throw an exception.

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

    public static IAsyncOperation<string> GetPrincipalNameAsync()public static IAsyncOperation<string> GetPrincipalNameAsync()Public Static Function GetPrincipalNameAsync() As IAsyncOperation( Of string )

    Returns

    • The user's principal name.

    Remarks

    Important

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

    Only domain users have a principal name. Access to the principal name can be blocked by privacy settings (for example, if the NameAccessAllowed property is false). If access is blocked, this method returns an empty string.

    This method requires the enterpriseAuthentication capability.

    This method does not throw an exception.

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

    public static IAsyncOperation<Uri> GetSessionInitiationProtocolUriAsync()public static IAsyncOperation<Uri> GetSessionInitiationProtocolUriAsync()Public Static Function GetSessionInitiationProtocolUriAsync() As IAsyncOperation( Of Uri )

    Returns

    • The Uniform Resource Identifier (URI) of the session initiation protocol.

    Remarks

    Important

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

    Access to the Uniform Resource Identifier (URI) of the session initiation protocol for the user can be blocked by privacy settings (for example, if the NameAccessAllowed property is false). If access is blocked, this method returns a null value.

    This method does not throw an exception.

  • SetAccountPictureAsync(Windows.Storage.IStorageFile)
    SetAccountPictureAsync(Windows.Storage.IStorageFile)
    SetAccountPictureAsync(Windows.Storage.IStorageFile)
    SetAccountPictureAsync(Windows.Storage.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.

    public static IAsyncOperation<SetAccountPictureResult> SetAccountPictureAsync(Windows.Storage.IStorageFile image)public static IAsyncOperation<SetAccountPictureResult> SetAccountPictureAsync(Windows.Storage.IStorageFile image)Public Static Function SetAccountPictureAsync(image As Windows.Storage.IStorageFile) As IAsyncOperation( Of SetAccountPictureResult )

    Parameters

    Returns

    • A value that indicates the success or failure of the operation.

    Remarks

    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(Windows.Storage.Streams.IRandomAccessStream)
    SetAccountPictureFromStreamAsync(Windows.Storage.Streams.IRandomAccessStream)
    SetAccountPictureFromStreamAsync(Windows.Storage.Streams.IRandomAccessStream)
    SetAccountPictureFromStreamAsync(Windows.Storage.Streams.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.

    public static IAsyncOperation<SetAccountPictureResult> SetAccountPictureFromStreamAsync(Windows.Storage.Streams.IRandomAccessStream image)public static IAsyncOperation<SetAccountPictureResult> SetAccountPictureFromStreamAsync(Windows.Storage.Streams.IRandomAccessStream image)Public Static Function SetAccountPictureFromStreamAsync(image As Windows.Storage.Streams.IRandomAccessStream) As IAsyncOperation( Of SetAccountPictureResult )

    Parameters

    Returns

    • A value that indicates the success or failure of the operation.

    Remarks

    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(Windows.Storage.IStorageFile,Windows.Storage.IStorageFile,Windows.Storage.IStorageFile)
    SetAccountPicturesAsync(Windows.Storage.IStorageFile,Windows.Storage.IStorageFile,Windows.Storage.IStorageFile)
    SetAccountPicturesAsync(Windows.Storage.IStorageFile,Windows.Storage.IStorageFile,Windows.Storage.IStorageFile)
    SetAccountPicturesAsync(Windows.Storage.IStorageFile,Windows.Storage.IStorageFile,Windows.Storage.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.

    public static IAsyncOperation<SetAccountPictureResult> SetAccountPicturesAsync(Windows.Storage.IStorageFile smallImage,Windows.Storage.IStorageFile largeImage,Windows.Storage.IStorageFile video)public static IAsyncOperation<SetAccountPictureResult> SetAccountPicturesAsync(Windows.Storage.IStorageFile smallImage,Windows.Storage.IStorageFile largeImage,Windows.Storage.IStorageFile video)Public Static Function SetAccountPicturesAsync(smallImage As Windows.Storage.IStorageFile,largeImage As Windows.Storage.IStorageFile,video As Windows.Storage.IStorageFile) As IAsyncOperation( Of SetAccountPictureResult )

    Parameters

    Returns

    • A value that indicates the success or failure of the operation.

    Remarks

    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(Windows.Storage.Streams.IRandomAccessStream,Windows.Storage.Streams.IRandomAccessStream,Windows.Storage.Streams.IRandomAccessStream)
    SetAccountPicturesFromStreamsAsync(Windows.Storage.Streams.IRandomAccessStream,Windows.Storage.Streams.IRandomAccessStream,Windows.Storage.Streams.IRandomAccessStream)
    SetAccountPicturesFromStreamsAsync(Windows.Storage.Streams.IRandomAccessStream,Windows.Storage.Streams.IRandomAccessStream,Windows.Storage.Streams.IRandomAccessStream)
    SetAccountPicturesFromStreamsAsync(Windows.Storage.Streams.IRandomAccessStream,Windows.Storage.Streams.IRandomAccessStream,Windows.Storage.Streams.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.

    public static IAsyncOperation<SetAccountPictureResult> SetAccountPicturesFromStreamsAsync(Windows.Storage.Streams.IRandomAccessStream smallImage,Windows.Storage.Streams.IRandomAccessStream largeImage,Windows.Storage.Streams.IRandomAccessStream video)public static IAsyncOperation<SetAccountPictureResult> SetAccountPicturesFromStreamsAsync(Windows.Storage.Streams.IRandomAccessStream smallImage,Windows.Storage.Streams.IRandomAccessStream largeImage,Windows.Storage.Streams.IRandomAccessStream video)Public Static Function SetAccountPicturesFromStreamsAsync(smallImage As Windows.Storage.Streams.IRandomAccessStream,largeImage As Windows.Storage.Streams.IRandomAccessStream,video As Windows.Storage.Streams.IRandomAccessStream) As IAsyncOperation( Of SetAccountPictureResult )

    Parameters

    Returns

    • A value that indicates the success or failure of the operation.

    Remarks

    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

    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.

    public static event EventHandler AccountPictureChangedpublic static event EventHandler AccountPictureChangedPublic Static Event AccountPictureChanged

    Remarks

    Important

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

    Use this event to monitor changes to the user's account picture.

    Access to this event can be blocked by privacy settings. If access is blocked, the AccountPictureChangeEnabled property will be false.

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)

Attributes

Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.DualApiPartitionAttribute
Windows.Foundation.Metadata.StaticAttribute

Details

Assembly

Windows.System.UserProfile.dll