Introduced
Re-imagine the Windows 8 Store Apps Microsoft account
Get user-related information for Microsoft account
Get or set up pictures and videos of Microsoft account
Microsoft account verification, and the acquisition of relevant information
Example
1, to demonstrate how to obtain the Microsoft account user-related information
Account/accountinfo.xaml
<page
x:class= "XamlDemo.Account.AccountInfo"
xmlns= "http://schemas.microsoft.com/winfx/2006/xaml/ Presentation "
xmlns:x=" Http://schemas.microsoft.com/winfx/2006/xaml "
xmlns:local=" using: Xamldemo.account "
xmlns:d=" http://schemas.microsoft.com/expression/blend/2008 "
xmlns:mc=" http:// schemas.openxmlformats.org/markup-compatibility/2006 "
mc:ignorable=" D ">
<grid background=" Transparent ">
<stackpanel margin=" 0 0 0 ">
<textblock name=" lblmsg "fontsize=" 14.667 "/>
</StackPanel>
</Grid>
</Page>
Account/accountinfo.xaml.cs
* * Demo How to Obtain Microsoft account user-related information * * using System;
Using Windows.System.UserProfile;
Using Windows.UI.Xaml.Controls;
Using Windows.UI.Xaml.Navigation;
Namespace Xamldemo.account {public sealed partial class Accountinfo:page {public AccountInfo () {this.
InitializeComponent (); } protected async override void Onnavigatedto (NavigationEventArgs e) {if (userinformatio n.nameaccessallowed)//whether to allow access to user name {//Get the name used for display Lblmsg.text = "Display Name:
"+ await Userinformation.getdisplaynameasync ();
Lblmsg.text + = Environment.NewLine;
Gets the name Lblmsg.text + = "Name:" + await userinformation.getfirstnameasync ();
Lblmsg.text + = Environment.NewLine;
Gets the last name lblmsg.text = "Last name:" + await userinformation.getlastnameasync (); LblmsG.text + = Environment.NewLine;
///If you need to obtain Getdomainnameasync (), Getprincipalnameasync (), Getsessioninitiationprotocoluriasync () and other information
You need to add the configuration <capability name= "Enterpriseauthentication"/> in the Package.appxmanifest, and you must use the company account to upload the app} }
}
2, demo how to get or set the Microsoft account picture and video
Account/accountpicture.xaml
<page x:class= "XamlDemo.Account.AccountPicture" xmlns= "Http://schemas.microsoft.com/winfx/2006/xaml/presentat Ion "xmlns:x=" Http://schemas.microsoft.com/winfx/2006/xaml "xmlns:local=" Using:XamlDemo.Account "xmlns:d=" http ://schemas.microsoft.com/expression/blend/2008 "xmlns:mc=" http://schemas.openxmlformats.org/ markup-compatibility/2006 "mc:ignorable=" D "> <grid background=" Transparent "> <stackpanel margin= "0 0 0" > <stackpanel orientation= "Horizontal" > <button x:name= "btn
SetImage "content=" set the current Microsoft account of the picture (you can specify the small map, large image, video) "click=" Btnsetimage_click_1/> </StackPanel> <stackpanel orientation= "Horizontal" margin= "0 0 0" > <image x:name= "imgsmall" width= " "height=" horizontalalignment= "left"/> <image x:name= "Imglarge" width= "448" height= "448" Marg
in= "0 0 0" horizontalalignment= "left"/> <mediaelement x:name= "MediaElement" width= "height=" margin= "0 0 0" horizontalalignment= "left"/ > </StackPanel> </StackPanel> </Grid> </Page>