1

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?

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
Balraj Singh
  • 3,381
  • 6
  • 47
  • 82
  • Make sure to check the privacy settings or your account allow that. Also it looks like the GetPrincipalName only works with a domain users. http://msdn.microsoft.com/en-in/library/windows/apps/windows.system.userprofile.userinformation.getprincipalnameasync – seshuk Jul 18 '13 at 08:34
  • In my privacy settings i have allowed everything. But still not able to get email id. – Balraj Singh Jul 18 '13 at 08:45
  • I have tried everything but no sucess I don't know why.. – Balraj Singh Jul 18 '13 at 12:42

1 Answers1

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.

Malachi
  • 3,205
  • 4
  • 29
  • 46
Jim O'Neil
  • 23,344
  • 7
  • 42
  • 67