Get user information in Windows 8?

守給你的承諾、 提交于 2020-01-15 09:13:19

问题


I have created a sample in Windows 8 using C# and XAML to get user info of my system which includes Name, Email Id, Photo of my User Login. I am able to get Name and image but I am not able to get Email Id. My system is logged in by my hotmail id. Following is the code: how can I achieve to get email id?

string displayName = await UserInformation.GetDisplayNameAsync();
string Emailid = await UserInformation.GetPrincipalNameAsync();
StorageFile image = UserInformation.GetAccountPicture(AccountPictureKind.LargeImage) as StorageFile;

In Email id I am getting blank. How to fix it?


回答1:


@seshuk had given you the correct answer, from the MSDN documentation

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

This method requires the enterpriseAuthentication capability.

A Hotmail id, by definition, would not be a domain user. Additionally, you'd need a company account to publish such an app, since it requires the enterprise authentication capability.



来源:https://stackoverflow.com/questions/17718227/get-user-information-in-windows-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!