Legacy Code
Legacy Code

Reputation: 750

UWP and User Profile Image

UserInformation.SetAccountPictureAsync does not work in Win10 UWP apps. Is there any replacement for this? The User class does not have any Set Method, just a Get.

Upvotes: 1

Views: 903

Answers (1)

Jayden
Jayden

Reputation: 3286

As you know, the UserInformation class is not supported on Windows 10 or later. Use the User class instead it. And the User class has not set account picture API.

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.

For more info, see remarks section of UserInformation.

You can set account picture by user manually. Use Launcher.LaunchUriAsync to launch to the set account picture page.

For example:

bool result = await Launcher.LaunchUriAsync(new Uri("ms-settings:emailandaccounts"));

Also you can use Windows Feedback app to feedback your advice to Microsoft.

Upvotes: 2

Related Questions