在 Windows 8 中获取用户信息? [英] Get user information in Windows 8?
问题描述
我使用 C# 和 XAML 在 Windows 8 中创建了一个示例,以获取我的系统的用户信息,其中包括姓名、电子邮件 ID、我的用户登录照片.我能够获得姓名和图像,但无法获得电子邮件 ID.我的系统是通过我的 hotmail id 登录的.以下是代码:如何获取电子邮件 ID?
string displayName = await UserInformation.GetDisplayNameAsync();string Emailid = await UserInformation.GetPrincipalNameAsync();StorageFile image = UserInformation.GetAccountPicture(AccountPictureKind.LargeImage) as StorageFile;
在电子邮件 ID 中,我变得空白.如何解决?
@seshuk 已经给了你正确的答案,来自 MSDN 文档
<块引用>只有域用户才有主体名称.可以阻止访问主体名称通过隐私设置(例如,如果 UserInformation::NameAccessAllowed 属性是假的).如果访问被阻止,此方法返回一个空字符串.
<块引用>
此方法需要企业身份验证功能.
Hotmail id,根据定义,不会是域用户.此外,您需要一个公司帐户才能发布此类应用,因为它需要企业身份验证功能.
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?
@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.
这篇关于在 Windows 8 中获取用户信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!