<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US"><title type="html">Shelly Guo @ MS</title><subtitle type="html" /><id>http://blogs.msdn.com/b/shelly_guos_ms_blog/atom.aspx</id><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/shelly_guos_ms_blog/" /><link rel="self" type="application/atom+xml" href="http://blogs.msdn.com/b/shelly_guos_ms_blog/atom.aspx" /><generator uri="http://telligent.com" version="5.6.50428.7875">Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><updated>2011-09-16T07:11:00Z</updated><entry><title>Powering your Windows 8 apps and websites with Microsoft accounts</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/shelly_guos_ms_blog/archive/2012/12/26/powering-your-windows-8-apps-and-websites-with-microsoft-accounts.aspx" /><id>http://blogs.msdn.com/b/shelly_guos_ms_blog/archive/2012/12/26/powering-your-windows-8-apps-and-websites-with-microsoft-accounts.aspx</id><published>2012-12-26T23:45:41Z</published><updated>2012-12-26T23:45:41Z</updated><content type="html">&lt;p&gt;&lt;font size="2"&gt;With the release of Windows 8 and the new app distribution channel through the Windows Store, developers now are embracing a completely new and different programming model.&amp;#160; One of the often under-looked features in this new ecosystem is the ability for applications and websites to leverage users’ Microsoft accounts to provide personalized content without ever prompting the user to sign in.&amp;#160; For client only apps, using SSO along with other Windows services such as Profile allows app developers to easily access user’s information and provide customized experiences without requiring additional user gesture.&amp;#160; Apps can also leverage the 7GB free cloud storage that every Windows user has to store information in SkyDrive that is accessible from any platform.&amp;#160; For websites or apps that have a server component, implementing SSO becomes even more compelling because now you can deliver personalized content to your users without having your own identity system.&amp;#160; Even if you already have an identity system on your website, you can still benefit from SSO because with the support from the OS, the sign in and sign up experiences become much more seamless.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;The &lt;a title="Live Connect Developer Center" href="http://dev.live.com/"&gt;Live SDK&lt;/a&gt; is a set of client APIs that make integrating with MSA and Windows services simple and straightforward.&amp;#160; The &lt;a title="Live SDK Downloads" href="http://msdn.microsoft.com/en-US/live/ff621310"&gt;V5.3 version&lt;/a&gt; of the Live SDK was recently released which includes updated Windows 8 SDKs and brand new .Net SDKs for classic desktop apps and Asp.Net apps.&amp;#160; In this post, I will talk about how to use these SDKs to implement Single-sign-on (SSO) using Microsoft accounts (MSA) for Windows Store apps and Asp.Net websites. (I choose to talk about Asp.Net websites purely because we have an existing SDK for it. The concept though applies to websites implemented using other technologies as well.) If you want to take an in-depth look at the benefits and the technology used in SSO on Windows, check out the &lt;a title="Powering your apps with Microsoft accounts" href="http://channel9.msdn.com/Events/Build/2012/3-138"&gt;//BUILD2012 talk on this topic&lt;/a&gt;. For those who just want to get start on code, it is my hope that content in this post would help you get right on track.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;strong&gt;Pre-requisite&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font size="2"&gt;Windows 8 and Visual Studio 2012.&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="2"&gt;&lt;a title="Live SDK Downloads" href="http://msdn.microsoft.com/en-US/live/ff621310"&gt;Live SDK V5.3&lt;/a&gt;&lt;/font&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;&lt;font size="2"&gt;Implementing SSO for Windows Store apps&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Implementing SSO for a Windows Store app is very straightforward.&amp;#160; Follow the following steps and you’ll be done in 5 minutes.&amp;#160; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;1. Create a new Windows Store C# app called HelloWorldWin8 in Visual Studio 2012.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/4237.image_5F00_099FC961.png"&gt;&lt;img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/5707.image_5F00_thumb_5F00_6265802B.png" width="589" height="380" /&gt;&lt;/a&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;2. Bring up the Add Reference dialog, fine the Windows/Extensions tab and add Live SDK to the project.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/4721.image_5F00_7037C626.png"&gt;&lt;img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/5381.image_5F00_thumb_5F00_691889AE.png" width="586" height="382" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;3. Add an image control and a textbox control to the main page.&amp;#160; The image control will be used to display the user’s profile picture and the textbblock will be used to show a greeting message.&amp;#160; The complete XAML is shown below:&lt;/font&gt;&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Page&lt;/span&gt;
    &lt;span class="attr"&gt;x:Class&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;HelloWorldWin8.MainPage&amp;quot;&lt;/span&gt;
    &lt;span class="attr"&gt;xmlns&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;&lt;/span&gt;
    &lt;span class="attr"&gt;xmlns:x&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;&lt;/span&gt;
    &lt;span class="attr"&gt;xmlns:local&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;using:HelloWorldWin8&amp;quot;&lt;/span&gt;
    &lt;span class="attr"&gt;xmlns:d&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://schemas.microsoft.com/expression/blend/2008&amp;quot;&lt;/span&gt;
    &lt;span class="attr"&gt;xmlns:mc&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://schemas.openxmlformats.org/markup-compatibility/2006&amp;quot;&lt;/span&gt;
    &lt;span class="attr"&gt;mc:Ignorable&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;d&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;

    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Grid&lt;/span&gt; &lt;span class="attr"&gt;Background&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;{StaticResource ApplicationPageBackgroundThemeBrush}&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Image&lt;/span&gt; &lt;span class="attr"&gt;x:Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;imgMe&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;HorizontalAlignment&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Left&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Height&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;150&amp;quot;&lt;/span&gt;  &lt;span class="attr"&gt;Width&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;150&amp;quot;&lt;/span&gt; 
&lt;span class="attr"&gt;Margin&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;230,330,0,0&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;VerticalAlignment&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Top&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;TextBlock&lt;/span&gt; &lt;span class="attr"&gt;x:Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;tbGreeting&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;HorizontalAlignment&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Left&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Margin&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;450,350,0,0&amp;quot;&lt;/span&gt; 
&lt;span class="attr"&gt;VerticalAlignment&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Top&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Height&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;50&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Width&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;823&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;FontSize&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;32&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;TextBlock&lt;/span&gt; &lt;span class="attr"&gt;x:Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;tbError&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;HorizontalAlignment&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Left&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Margin&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;230,560,0,0&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;TextWrapping&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Wrap&amp;quot;&lt;/span&gt; 
&lt;span class="attr"&gt;VerticalAlignment&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Top&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Height&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;175&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Width&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;1043&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Grid&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Page&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;


&lt;pre class="csharpcode"&gt;&lt;font face="Segoe UI"&gt;4. Add the following code to mainpage.xaml.cs.&lt;/font&gt;&lt;/pre&gt;

&lt;div style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: rgb(244, 244, 244);" id="codeSnippetWrapper"&gt;
  &lt;div style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);" id="codeSnippet"&gt;
    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt; System;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt; Windows.UI.Xaml.Controls;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt; Windows.UI.Xaml.Media.Imaging;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt; Windows.UI.Xaml.Navigation;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt; Microsoft.Live;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;namespace&lt;/span&gt; HelloWorldWin8&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;{&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;    &lt;span style="color: rgb(0, 128, 0);"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;    &lt;span style="color: rgb(0, 128, 0);"&gt;/// An empty page that can be used on its own or navigated to within a Frame.&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;    &lt;span style="color: rgb(0, 128, 0);"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;    &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;sealed&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;partial&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; MainPage : Page&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;static&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;[] scopes = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;[] { &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;wl.signin wl.basic&amp;quot;&lt;/span&gt; };&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt; LiveAuthClient authClient;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; MainPage()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;.InitializeComponent();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;.authClient = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; LiveAuthClient();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;        }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;        &lt;span style="color: rgb(0, 128, 0);"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        &lt;span style="color: rgb(0, 128, 0);"&gt;/// Invoked when this page is about to be displayed in a Frame.&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;        &lt;span style="color: rgb(0, 128, 0);"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        &lt;span style="color: rgb(0, 128, 0);"&gt;/// &amp;lt;param name=&amp;quot;e&amp;quot;&amp;gt;Event data that describes how this page was reached.  The Parameter&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;        &lt;span style="color: rgb(0, 128, 0);"&gt;/// property is typically used to configure the page.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;protected&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;override&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt; OnNavigatedTo(NavigationEventArgs e)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;        {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;.SignInUser();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;        }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt; async &lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt; SignInUser()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;try&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;            {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                var loginResult = await &lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;.authClient.InitializeAsync(&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; List&amp;lt;&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;&amp;gt;(scopes));&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;                &lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt; (loginResult.Status == LiveConnectSessionStatus.Connected)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;                    &lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;.GetMe();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;                &lt;span style="color: rgb(0, 0, 255);"&gt;else&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;                    loginResult = await &lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;.authClient.LoginAsync(&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; List&amp;lt;&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;&amp;gt;(scopes));&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                    &lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt; (loginResult.Status == LiveConnectSessionStatus.Connected)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;                    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                        &lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;.GetMe();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;                    }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;            }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;catch&lt;/span&gt; (LiveAuthException e)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;            {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                &lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;.tbError.Text = e.ToString();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;            }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;        }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt; async &lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt; GetMe()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;try&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;            {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                var connectClient = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; LiveConnectClient(&lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;.authClient.Session);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;                &lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;.imgMe.Source = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; BitmapImage()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;                    UriSource = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; Uri(&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;https://apis.live.net/v5.0/me/picture?access_token=&amp;quot;&lt;/span&gt; + &lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;.authClient.Session.AccessToken)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                };&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                var getResult = await connectClient.GetAsync(&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;me&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;                dynamic jsonResult = getResult.Result;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                &lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;.tbGreeting.Text = &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;Hello &amp;quot;&lt;/span&gt; + jsonResult.first_name + &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot; &amp;quot;&lt;/span&gt; + jsonResult.last_name;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;            }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;catch&lt;/span&gt; (LiveConnectException e)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;            {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                &lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;.tbError.Text = e.ToString();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;            }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;        }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;    }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&lt;font size="2"&gt;5. Provision your app to use Live Connect services.&amp;#160; Make sure you have a valid Windows Store developer license.&amp;#160; Go to Store –&amp;gt; Create App Packages from the Visual Studio menu (in the Ultimate version, this menu item is under Project –&amp;gt; Store –&amp;gt; Create App Packages), sign in and follow the steps to create a new Windows Store app.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;6. Run the application.&amp;#160; Upon app start, you will be prompted to give the app permission to access your data.&amp;#160; Click Yes.&amp;#160; Your profile picture should then appear along with a message that greets you by your name.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;7. Now you’re set up to use Microsoft accounts in your app, you can then add SkyDrive support by using our &lt;a title="SkyDrive REST API" href="http://msdn.microsoft.com/en-us/library/live/hh826521"&gt;SkyDrive API&lt;/a&gt;.&amp;#160; To learn more about how to work with SkyDrive, check out our //BUILD2012 talk “&lt;a title="The developer’s guide to the SkyDrive API" href="http://channel9.msdn.com/Events/Build/2012/3-139"&gt;The developer’s guide to the SkyDrive API&lt;/a&gt;” by Deepesh Mohnani.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;font size="2"&gt;Integrate Microsoft account and Windows services in your website&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;You can also integrate with Microsoft account in your website to use MSA as your identity system or to interact with user data stored in SkyDrive and other Windows services.&amp;#160; With the introduction of the new Asp.Net SDK, we’ve made this a much easier task than it used to be.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font size="2"&gt;To show you how to user the Asp.Net SDK to authenticate the user using MSA, I’m going to use the project I created for the BUILD talk as my code sample here.&amp;#160; It would be easier to walk through the code if you open the project in Visual Studio.&amp;#160; So here’s how you would set it up:&lt;/font&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;font size="2"&gt;First &lt;a title="SSOSample.zip" href="http://sdrv.ms/RSQyxI"&gt;download the project files&lt;/a&gt; and open the solution file YummySample.sln.&amp;#160; Notice that there are two projects in the solution, one YummyWin8App and YummyWebsite.&amp;#160; These two projects are designed to work with each other to demonstrate the interactions between your app and your companion website.&lt;/font&gt;&lt;/li&gt;

  &lt;li&gt;&lt;font size="2"&gt;Open the Win8 app project and follow the steps above to register this app with the Windows Store.&lt;/font&gt;&lt;/li&gt;

  &lt;li&gt;&lt;font size="2"&gt;While you’re still in the &lt;a href="https://appdev.microsoft.com/StorePortals/en-us/Home/Index"&gt;Windows Store developer portal&lt;/a&gt;, select your application, click on “Advanced features” –&amp;gt; “Push notifications and Live Connect services info” –&amp;gt; “Representing your app to Live Connect users”. Enter “http://www.yummywebsite.com&amp;quot; as the redirect domain for your app.&amp;#160; As an optional step, upload a logo.&lt;/font&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/3326.image_5F00_65075F18.png"&gt;&lt;img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/2330.image_5F00_thumb_5F00_4B9F5BDE.png" width="630" height="257" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Click the “Authenticating your service” link on the left nav and note down the two values on this page: Package Security Identifier (PSID) and Client secret.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/5557.image_5F00_2B844F21.png"&gt;&lt;img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/8780.image_5F00_thumb_5F00_3956951C.png" width="627" height="282" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;font size="2"&gt;Go back to Visual Studio, open YummyWebsite –&amp;gt; Controllers –&amp;gt; HomeController.cs file and copy the values of your app’s client id (the PSID) and client secret to the corresponding variables at the top of the file.&amp;#160; Do the same for the AccountControll.cs file.&amp;#160; &lt;/font&gt;&lt;/li&gt;

  &lt;li&gt;&lt;font size="2"&gt;Next, you need to configure you website on your local IIS server.&amp;#160; Go to IIS Manager, add a new website call “YummyWebsite” and configure it to point to where your copied the project files to on your local file system.&amp;#160; Set the host name to be “http://www.yummywebsite.com”.&lt;/font&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/5314.image_5F00_61F94D36.png"&gt;&lt;img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/6874.image_5F00_thumb_5F00_6FCB9331.png" width="635" height="569" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;font size="2"&gt;Add a host entry in your hosts file that points to your local IIS.&lt;/font&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
  &lt;p&gt;127.0.0.1&amp;#160;&amp;#160;&amp;#160; &lt;a href="http://www.yummywebsite.com"&gt;www.yummywebsite.com&lt;font size="2"&gt;&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;font size="2"&gt;Now you should be set up to run the sample.&amp;#160; Make sure you’re logged in to the OS with either a Microsoft account or a MSA connected domain/local account.&amp;#160; &lt;/font&gt;&lt;font size="2"&gt;In IE10, browse to &lt;a href="http://www.yummywebsite.com"&gt;http://www.yummywebsite.com&lt;/a&gt; and see the web page loads with pictures of yummy food.&amp;#160; Notice there is no personal information displayed on the page.&lt;/font&gt;&lt;/li&gt;

  &lt;li&gt;&lt;font size="2"&gt;Click the Register link at the upper right corner.&amp;#160; This takes you to a page where the website asks you to register for an account.&amp;#160; For the simplicity of the sample, the registration logic is not implemented.&amp;#160; The purpose of this page is to serve as a proof-of-concept that you can streamline sign-up with information about the user and make the process much less intimidating.&lt;/font&gt;&lt;/li&gt;

  &lt;li&gt;&lt;font size="2"&gt;Once you click the Register button, it takes you back to the home page where you now will see your name and profile picture show up at the upper right corner.&amp;#160; You have now signed in to the website using your MSA.&lt;/font&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;font size="2"&gt;Now let’s take a look at the code for the home controller:&lt;/font&gt;&lt;/p&gt;

&lt;div style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: rgb(244, 244, 244);" id="codeSnippetWrapper"&gt;
  &lt;div style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);" id="codeSnippet"&gt;
    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; async Task&amp;lt;ActionResult&amp;gt; Index()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            HomePageModel model = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; HomePageModel();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;            model.Pictures = &lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;.GetPictures();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            model.Favorites = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; List&amp;lt;&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;&amp;gt;();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;            model.ProfileImageUrl = &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;Images/user.png&amp;quot;&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;            &lt;span style="color: rgb(204, 102, 51);"&gt;#region&lt;/span&gt; LiveSDK Impl&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;            HttpCookie stateCookie = &lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;.Request.Cookies[&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;state&amp;quot;&lt;/span&gt;];&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt; (stateCookie == &lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt; || &lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;.Compare(stateCookie.Value, &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;registered&amp;quot;&lt;/span&gt;, &lt;span style="color: rgb(0, 0, 255);"&gt;true&lt;/span&gt;) != 0)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;            {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; View(model);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;            }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;            LiveLoginResult loginResult = await &lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;.authClient.InitializeWebSessionAsync(&lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;.HttpContext);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt; (loginResult != &lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt; &amp;amp;&amp;amp; loginResult.Status == LiveConnectSessionStatus.Connected)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;            {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                model.LoginUrl = &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;&amp;quot;&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;                model.ProfileImageUrl = &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;https://apis.live.net/v5.0/me/picture?access_token=&amp;quot;&lt;/span&gt; + loginResult.Session.AccessToken;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;                var connectClient = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; LiveConnectClient(loginResult.Session);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                var getResult = await connectClient.GetAsync(&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;me&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;                var jsonResult = getResult.Result &lt;span style="color: rgb(0, 0, 255);"&gt;as&lt;/span&gt; dynamic;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                model.UserName = jsonResult.first_name + &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot; &amp;quot;&lt;/span&gt; + jsonResult.last_name;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                model.Favorites = &lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;.GetFavorites(loginResult.Session.AuthenticationToken);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;            }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;else&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt; (loginResult != &lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt; &amp;amp;&amp;amp;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;                loginResult.Status == LiveConnectSessionStatus.Unknown || loginResult.Status == LiveConnectSessionStatus.Expired)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;                Dictionary&amp;lt;&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;, &lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;&amp;gt; options = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; Dictionary&amp;lt;&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;, &lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;&amp;gt;();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                options.Add(&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;display&amp;quot;&lt;/span&gt;, &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;none&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;                &lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt; reAuthUrl = &lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;.authClient.GetLoginUrl(&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; List&amp;lt;&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;&amp;gt;(scopes), options);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; RedirectResult(reAuthUrl);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;            }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;else&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;            {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                model.LoginUrl = &lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;.authClient.GetLoginUrl(&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; List&amp;lt;&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;&amp;gt;(scopes));&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;                model.ProfileImageUrl = &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;Images/user.png&amp;quot;&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            &lt;span style="color: rgb(204, 102, 51);"&gt;#endregion&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; View(model);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&lt;font size="2"&gt;The line of code that I want to highlight is this:&lt;/font&gt;&lt;/p&gt;

&lt;pre class="csharpcode"&gt;LiveLoginResult loginResult = await &lt;span class="kwrd"&gt;this&lt;/span&gt;.authClient.InitializeWebSessionAsync(&lt;span class="kwrd"&gt;this&lt;/span&gt;.HttpContext);&lt;/pre&gt;
&lt;font size="2"&gt;&lt;/font&gt;

&lt;p&gt;&lt;font face="Segoe UI"&gt;&lt;font size="2"&gt;The LiveAuthClient.InitializeWebSessionAsync function is the main function that handles the web authentication flow for &lt;/font&gt;&lt;a title="OAuth 2.0 draft 21" href="http://tools.ietf.org/html/draft-ietf-oauth-v2-21"&gt;&lt;font size="2"&gt;OAuth 2.0&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt;. If the user has 1) signed in to MSA either through the OS for IE or through the web for any browsers that support cookies; 2) granted permission for the app to access his information, the user will be signed in to your website and you can go ahead with retrieving user information from Windows services.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;If the user’s status is not Connected, it means either the user is not signed or the user has not given the app permission to access his data.&amp;#160; In these cases, the app needs to call LiveAuthClient.GetLoginUrl to get the url for the sign-in/consent page and redirect the browser to that page so the user can finish the sign-in flow.&amp;#160; &lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;Notice that at the top of the HomeController.cs file, we specify the value for redirectUrl as&lt;/font&gt;&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; redirectUrl = &lt;span class="str"&gt;&amp;quot;http://www.yummywebsite.com/home/login&amp;quot;&lt;/span&gt;;&lt;/pre&gt;


&lt;p&gt;&lt;font size="2"&gt;How is this used?&amp;#160; The OAuth web flow is a two step authentication process.&amp;#160; When the user grants consent to the web app, the authentication server sends a authorization code to the application web server (&lt;a href="http://www.yummywebsite.com"&gt;http://www.yummywebsite.com&lt;/a&gt;) and the application web server needs to exchange this code for the access token that it needs for retrieving data from the resource provider (&lt;a href="https://apis.live.net"&gt;https://apis.live.net&lt;/a&gt;).&amp;#160; The redirect url tells the authentication server where to send the authorization code to.&amp;#160; You can use the default path to handle redirect, but we recommend that you use a separate path or a different controller for the sole purpose of handling OAuth redirect.&amp;#160;&amp;#160; It makes to code easier to read and maintain.&amp;#160; In my example, I’m using the path /home/login to handle the redirect. &lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;The AccountController class handles the /account/register path.&amp;#160; The logic here is similar to that of the home controller.&amp;#160; Notice the code below:&lt;/font&gt;&lt;/p&gt;

&lt;pre class="csharpcode"&gt;Dictionary&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;, &lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt; options = &lt;span class="kwrd"&gt;new&lt;/span&gt; Dictionary&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;, &lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt;();
options.Add(&lt;span class="str"&gt;&amp;quot;state&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;register&amp;quot;&lt;/span&gt;);
&lt;span class="kwrd"&gt;string&lt;/span&gt; reAuthUrl = authClient.GetLoginUrl(&lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt;(scopes), options);
&lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; RedirectResult(reAuthUrl);&lt;/pre&gt;


&lt;p&gt;&lt;font size="2"&gt;Here we’re getting the login url by calling LiveAuthClient.GetLoginUrl.&amp;#160; A ‘state’ parameter is added to the login url to track the current navigation state and the user is taking to the MSA login or consent page when the browser gets redirected to the login url.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;font size="2"&gt;Tracking user on your website and providing personalized content&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;So far, I have not talked about how to link the Win8 app and the website together and have SSO work across the two.&amp;#160; I will devote this section for that purpose.&amp;#160; First let’s talk about SSO across the app and the website.&amp;#160; The promise here is if you are signed in to the app on a connected windows device, you’re also signed in to the website and vice versa.&amp;#160; To see how it works, now run the YummyWin8 app again.&amp;#160; You will notice that after the app initializes, your name and profile pictures shows up at the upper right corner.&amp;#160; This is because you’ve already given the app permission to sign in when you went through the registration process on the website.&amp;#160; The app now can automatically sign you in when it starts.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;Now you have SSO between the app and the website, we can then talk about tracking users and providing personalized content.&amp;#160; &lt;font size="2"&gt;The key that provides the link between the app and the website in terms of user tracking is a ticket that’s known as the “Authentication Token”.&amp;#160;&amp;#160; So far, when we talk about authentication and authorization through OAuth, we talk about the “access token”. An access token is a ticket that the authentication server gives to the application for accessing data from a resource provider. In most cases, the resource provider is owned by the same entity that owns the authentication server. For example, the SkyDrive API service is a resource provider that accepts Microsoft account’s OAuth access token. The authentication token on the other hand, is a ticket that is understood by the application website, i.e. your website. This ticket contains a unique user id that your app can use to identify the user. The ticket is encrypted using the application secret that only your app knows about, therefore only understood by your app. &lt;/font&gt;&lt;font size="2"&gt;Once you are able to uniquely identify your user, you have the foundation for providing personalized content. You can use this unique user id as key into your database, or any other way you choose to store user information. &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;The authentication token is exposed as the AuthenticationToken property on the LiveConnectSession object.&amp;#160; Note that this property is only set if the application has a redirect domain registered.&amp;#160; Apps that don’t have a server-side component have no use of this token.&amp;#160; &lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;To decrypt the authentication token, you need your app’s client secret.&amp;#160; The authentication token is encrypted with your client secret using the standard &lt;a title="Json Web Token" href="http://www.ietf.org/mail-archive/web/oauth/current/msg04407.html"&gt;JWT format&lt;/a&gt;.&amp;#160; Because only your web server has access to the client secret, you must send the authentication token to your website for decryption.&amp;#160; We ask that under no circumstances, client secret should be store on user machines.&amp;#160; The Asp.Net SDK provides a utility method to decrypt the token and extract the user id.&amp;#160; You can call LiveAuthClient.GetUserId and pass in the authentication token.&amp;#160; The return value is the unique user id you can use to identify the current user.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;The “Add to favorites” functionality in the sample app leverages the authentication token to store user favorites on the server.&amp;#160; You can easily expand this to include any personalized content you want to build for your app.&amp;#160; To see how the favorites functionality work in this sample, follow these steps:&lt;/font&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;font size="2"&gt;Start the website by going to &lt;a href="http://www.yummywebsite.com"&gt;http://www.yummywebsite.com&lt;/a&gt;&lt;/font&gt;&lt;/li&gt;

  &lt;li&gt;&lt;font size="2"&gt;Run the YummyWin8 app.&lt;/font&gt;&lt;/li&gt;

  &lt;li&gt;&lt;font size="2"&gt;Click on a couple pictures and see them being selected.&lt;/font&gt;&lt;/li&gt;

  &lt;li&gt;&lt;font size="2"&gt;Click the “Add to favorites” header.&lt;/font&gt;&lt;/li&gt;

  &lt;li&gt;&lt;font size="2"&gt;Notices the favorites being added to the favorites column.&lt;/font&gt;&lt;/li&gt;

  &lt;li&gt;&lt;font size="2"&gt;Go back to the website and refresh the page.&amp;#160; Notice the favorites also show up on the website.&lt;/font&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;font size="2"&gt;How does this work?&amp;#160; It works with the Win8 app sending the authentication token along with the list of user favorites to the web server.&amp;#160; The website then decrypts the token, gets the unique user id and stores the favorites list for this user.&amp;#160; The website can also display the favorites by getting its own authentication token, decrypts it and then retrieve the favorites list for the current user.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;That’s it.&amp;#160; You have set up the foundation to power your app and your website with Microsoft accounts and Windows services.&amp;#160; Now it’s up to you to create the most awesome app for the new Windows ecosystem and good luck!&lt;/font&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10380845" width="1" height="1"&gt;</content><author><name>Shelly Guo</name><uri>http://blogs.msdn.com/shellyguo_4000_live.com/ProfileUrlRedirect.ashx</uri></author></entry><entry><title>Get Started on Live SDK for Windows Phone 7.x</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/shelly_guos_ms_blog/archive/2012/12/26/getting-started-on-live-sdk-for-windows-phone-7-x.aspx" /><id>http://blogs.msdn.com/b/shelly_guos_ms_blog/archive/2012/12/26/getting-started-on-live-sdk-for-windows-phone-7-x.aspx</id><published>2012-12-26T18:10:03Z</published><updated>2012-12-26T18:10:03Z</updated><content type="html">&lt;p&gt;&lt;em&gt;[Update on 12/27/2012] If you’re looking for the starter guide for Live SDK on &lt;strong&gt;Windows Phone 8&lt;/strong&gt;, please refer to this &lt;a href="http://blogs.msdn.com/b/shelly_guos_ms_blog/archive/2011/09/20/get-started-on-live-sdk-for-windows-phone.aspx"&gt;&lt;strong&gt;post&lt;/strong&gt;&lt;/a&gt;.&amp;#160; If you’re looking for the starter guide for Live SDK on &lt;strong&gt;Windows 8 or Asp.Net&lt;/strong&gt;, please refer to this &lt;a href="http://blogs.msdn.com/b/shelly_guos_ms_blog/archive/2012/12/26/powering-your-windows-8-apps-and-websites-with-microsoft-accounts.aspx"&gt;&lt;strong&gt;post&lt;/strong&gt;&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;[Update on 4/17/2012] We now have an &lt;/em&gt;&lt;a href="http://go.microsoft.com/fwlink/?LinkId=244052"&gt;&lt;em&gt;iOS SDK&lt;/em&gt;&lt;/a&gt;&lt;em&gt; and an &lt;/em&gt;&lt;a href="http://go.microsoft.com/fwlink/?LinkId=244051"&gt;&lt;em&gt;Android SDK&lt;/em&gt;&lt;/a&gt;&lt;em&gt; as well. Check it out! The 5.1 release is now live on &lt;/em&gt;&lt;a href="http://dev.live.com/"&gt;&lt;em&gt;Live Connect Developer Center&lt;/em&gt;&lt;/a&gt;&lt;em&gt;. This release fixes some known issues with the 5.0 release. It also include a version of the SDK for Windows 8 that’s compatible with the &lt;/em&gt;&lt;a href="http://msdn.microsoft.com/en-us/windows/apps/br229516"&gt;&lt;em&gt;Windows 8 Consumer Preview&lt;/em&gt;&lt;/a&gt;&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;a href="http://msdn.microsoft.com/en-us/windowslive/default"&gt;&lt;font size="2"&gt;Live Connect&lt;/font&gt;&lt;/a&gt; provides developers a set of controls and APIs that enable applications to integrate sign in with the user’s Microsoft account and enable users to access information from SkyDrive, Hotmail, and Messenger. In my previous posts, I talked about how to integrate &lt;/font&gt;&lt;font size="2"&gt;Live Connect&lt;/font&gt;&lt;font size="2"&gt; using the &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/live/ff621310"&gt;Live SDK&lt;/a&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font size="2"&gt; in &lt;/font&gt;&lt;a href="http://blogs.msdn.com/b/shelly_guos_ms_blog/archive/2011/09/16/a-step-by-step-guid-to-creating-your-first-hello-world-metro-style-app-using-live-connect.aspx"&gt;&lt;font size="2"&gt;Metro style apps written in JavaScript&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt; and in &lt;/font&gt;&lt;a href="http://blogs.msdn.com/b/shelly_guos_ms_blog/archive/2011/09/16/a-step-by-step-guide-to-creating-your-first-hello-world-metro-style-app-using-live-connect-in-c.aspx"&gt;&lt;font size="2"&gt;Metro style apps written in C#&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt;. If you’re a Windows Phone developer, the same SDK also supports integrating Live Connect in a Windows Phone app. In this post, I will walk through the steps for creating a simple Live Connect powered Windows Phone application.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;A few words on the behind the scene stuff before I start the step-by-step guide. When building Metro style apps on &lt;a href="http://msdn.microsoft.com/en-us/windows/apps/br229516"&gt;Windows 8 Consumer Preview&lt;/a&gt;, Single-Sign-On (SSO) is achieved with support from the OS. On Windows Phone, however, such support is not available for third party apps. To provide a good sign-in experience on mobile devices, Live Connect allows a mobile client to obtain a refresh token and use it to exchange for an access token. This provides a way for mobile clients to implement a Sign-In-Once experience and avoid the need to ask user for password every time the app is activated. To opt-in for this experience, your app needs to satisfy two criteria: &lt;/font&gt;&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;font size="2"&gt;The app must be provisioned as a mobile app.&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="2"&gt;User must grant the app offline access permission. &lt;/font&gt;&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&lt;font size="2"&gt;We will discuss the details on how to meet these two criteria in the following step-by-step guide.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Pre-requisite:&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font size="2"&gt;Download and&lt;font color="#000000"&gt; install &lt;/font&gt;&lt;a href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;amp;id=27153"&gt;&lt;font color="#000000"&gt; the&lt;/font&gt;&lt;/a&gt;&lt;font color="#000000"&gt; latest Windows Phone Developer Tools from &lt;a href="http://create.msdn.com/en-US/"&gt;App Hub&lt;/a&gt;.&lt;/font&gt;&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="2"&gt;Download and install &lt;a href="http://msdn.microsoft.com/en-us/live/ff621310"&gt;Live SDK&lt;/a&gt;.&lt;/font&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;font size="2"&gt;Let’s start by creating a new Windows Phone application. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;1. Create a new HelloWorldPhone Windows Phone application in Microsoft Visual Studio 2010 or Microsoft Visual Studio 2010 Express for Windows Phone using the Visual C# -&amp;gt; Silverlight for Windows Phone -&amp;gt; Windows Phone Application project template.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/6036.PhoneNewProj_5F00_4C30446B.png"&gt;&lt;img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="PhoneNewProj" border="0" alt="PhoneNewProj" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/1050.PhoneNewProj_5F00_thumb_5F00_1BB9BFF5.png" width="591" height="418" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;2. Bring up the Add Reference dialog and go to the .Net tab. Scroll down to find the Microsoft.Live and Microsoft.Live.Controls assemblies. Add them to your project.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/4606.PhoneAddRef_5F00_5B83A67A.png"&gt;&lt;img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="PhoneAddRef" border="0" alt="PhoneAddRef" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/7433.PhoneAddRef_5F00_thumb_5F00_17433F2E.png" width="591" height="481" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;3. Open MainPage.xaml in the designer. Bring the Toolbox in view and right-click to select Choose Items… Under Windows Phone Components tab, find the SignInButton control in the Microsoft.Live.Control namespace and add to your toolbox (You only need to do this once).&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/6355.PhoneToolBoxChooseItem_5F00_291FD2FB.png"&gt;&lt;img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="PhoneToolBoxChooseItem" border="0" alt="PhoneToolBoxChooseItem" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/3716.PhoneToolBoxChooseItem_5F00_thumb_5F00_22009683.png" width="588" height="472" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;The SignInButton control should now show up in your toolbox.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/4377.PhoneToolBoxItem_5F00_61CA7D08.png"&gt;&lt;img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="PhoneToolBoxItem" border="0" alt="PhoneToolBoxItem" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/2234.PhoneToolBoxItem_5F00_thumb_5F00_41AF704B.png" width="244" height="144" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;4. Drag the SignInButton onto your designer surface. In your xaml file, change the generated xml for the SignInButton to the following:&lt;/font&gt;&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;my:SignInButton&lt;/span&gt; &lt;span class="attr"&gt;Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;btnLogin&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;HorizontalAlignment&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Left&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Scopes&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;wl.signin wl.basic wl.offline_access&amp;quot; &lt;/span&gt;&lt;/pre&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="attr"&gt;SessionChanged&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;btnLogin_SessionChanged&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;&lt;font size="2"&gt;5. Add a couple TextBlock elements to display the greeting and the error message (in case something goes wrong). Here’s the complete xaml for MainPage.xaml.&lt;/font&gt;&lt;/p&gt;

&lt;div style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: rgb(244, 244, 244);" id="codeSnippetWrapper"&gt;
  &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);" id="codeSnippet"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;phone:PhoneApplicationPage&lt;/span&gt; &lt;br /&gt;    &lt;span style="color: rgb(255, 0, 0);"&gt;x:Class&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;HelloWorldPhone.MainPage&amp;quot;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: rgb(255, 0, 0);"&gt;xmlns&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: rgb(255, 0, 0);"&gt;xmlns:x&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: rgb(255, 0, 0);"&gt;xmlns:phone&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone&amp;quot;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: rgb(255, 0, 0);"&gt;xmlns:shell&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone&amp;quot;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: rgb(255, 0, 0);"&gt;xmlns:d&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;http://schemas.microsoft.com/expression/blend/2008&amp;quot;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: rgb(255, 0, 0);"&gt;xmlns:mc&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;http://schemas.openxmlformats.org/markup-compatibility/2006&amp;quot;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: rgb(255, 0, 0);"&gt;mc:Ignorable&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;d&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;d:DesignWidth&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;480&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;d:DesignHeight&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;768&amp;quot;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: rgb(255, 0, 0);"&gt;FontFamily&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;{StaticResource PhoneFontFamilyNormal}&amp;quot;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: rgb(255, 0, 0);"&gt;FontSize&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;{StaticResource PhoneFontSizeNormal}&amp;quot;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: rgb(255, 0, 0);"&gt;Foreground&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;{StaticResource PhoneForegroundBrush}&amp;quot;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: rgb(255, 0, 0);"&gt;SupportedOrientations&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;Portrait&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Orientation&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;Portrait&amp;quot;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: rgb(255, 0, 0);"&gt;shell:SystemTray&lt;/span&gt;.&lt;span style="color: rgb(255, 0, 0);"&gt;IsVisible&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;True&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;xmlns:my&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;clr-namespace:Microsoft.Live.Controls;assembly=Microsoft.Live.Controls&amp;quot;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: rgb(0, 128, 0);"&gt;&amp;lt;!--LayoutRoot is the root grid where all page content is placed--&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;Grid&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;x:Name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;LayoutRoot&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Background&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;Transparent&amp;quot;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;RowDefinition&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Height&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;129&amp;quot;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;RowDefinition&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Height&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;639*&amp;quot;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: rgb(0, 128, 0);"&gt;&amp;lt;!--TitlePanel contains the name of the application and page title--&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;StackPanel&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;x:Name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;TitlePanel&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Margin&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;12,17,0,0&amp;quot;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;TextBlock&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;x:Name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;ApplicationTitle&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Text&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;Hello World&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Style&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;{StaticResource PhoneTextNormalStyle}&amp;quot;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;my:SignInButton&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;btnLogin&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Scopes&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;wl.signin wl.basic wl.offline_access&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;SessionChanged&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;btnLogin_SessionChanged&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;Left&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;StackPanel&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: rgb(0, 128, 0);"&gt;&amp;lt;!--ContentPanel - place additional content here--&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;Grid&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;x:Name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;ContentPanel&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Grid&lt;/span&gt;.&lt;span style="color: rgb(255, 0, 0);"&gt;Row&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;1&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Margin&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;12,0,12,0&amp;quot;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;TextBlock&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;tbGreeting&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;FontSize&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;40&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Height&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;80&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;Left&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Margin&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;20,30,0,0&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Text&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;Hello&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;Top&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Width&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;418&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;TextBlock&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;tbError&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;FontSize&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;24&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Height&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;80&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;Left&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Margin&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;20,130,0,0&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Text&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;No Errors.&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;Top&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Width&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;418&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;Grid&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;Grid&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;phone:PhoneApplicationPage&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;br /&gt;&lt;/div&gt;

&lt;p&gt;&lt;font size="2"&gt;6. Add the following code in your MainPage.xaml.cs file.&lt;/font&gt;&lt;/p&gt;

&lt;div style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: rgb(244, 244, 244);" id="codeSnippetWrapper"&gt;
  &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);" id="codeSnippet"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt; System;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt; Microsoft.Phone.Controls;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt; Microsoft.Live;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt; Microsoft.Live.Controls;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;namespace&lt;/span&gt; HelloWorldPhone&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;partial&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; MainPage : PhoneApplicationPage&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt; LiveConnectClient liveClient;&lt;br /&gt;        &lt;br /&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; MainPage()&lt;br /&gt;        {&lt;br /&gt;            InitializeComponent();&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt; btnLogin_SessionChanged(&lt;span style="color: rgb(0, 0, 255);"&gt;object&lt;/span&gt; sender, LiveConnectSessionChangedEventArgs e)&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt; (e != &lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt; &amp;amp;&amp;amp; e.Status == LiveConnectSessionStatus.Connected)&lt;br /&gt;            {&lt;br /&gt;                &lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;.liveClient = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; LiveConnectClient(e.Session);&lt;br /&gt;&lt;br /&gt;                &lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;.GetMe();&lt;br /&gt;            }&lt;br /&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;else&lt;/span&gt;&lt;br /&gt;            {&lt;br /&gt;                &lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;.liveClient = &lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt;;&lt;br /&gt;                &lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;.tbError.Text = e.Error != &lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt; ? e.Error.ToString() : &lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;.Empty;&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt; GetMe()&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;.liveClient.GetCompleted += OnGetMe;&lt;br /&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;.liveClient.GetAsync(&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;me&amp;quot;&lt;/span&gt;, &lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt;);&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt; OnGetMe(&lt;span style="color: rgb(0, 0, 255);"&gt;object&lt;/span&gt; sender, LiveOperationCompletedEventArgs e)&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;.liveClient.GetCompleted -= OnGetMe;&lt;br /&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt; (e.Error == &lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt;)&lt;br /&gt;            {&lt;br /&gt;                &lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt; firstName = e.Result.ContainsKey(&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;first_name&amp;quot;&lt;/span&gt;) ? e.Result[&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;first_name&amp;quot;&lt;/span&gt;] &lt;span style="color: rgb(0, 0, 255);"&gt;as&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt; : &lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;.Empty;&lt;br /&gt;                &lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt; lastName = e.Result.ContainsKey(&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;last_name&amp;quot;&lt;/span&gt;) ? e.Result[&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;last_name&amp;quot;&lt;/span&gt;] &lt;span style="color: rgb(0, 0, 255);"&gt;as&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt; : &lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;.Empty;&lt;br /&gt;&lt;br /&gt;                &lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;.tbGreeting.Text = &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;Welcome &amp;quot;&lt;/span&gt; + firstName + &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot; &amp;quot;&lt;/span&gt; + lastName;&lt;br /&gt;            }&lt;br /&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;else&lt;/span&gt;&lt;br /&gt;            {&lt;br /&gt;                &lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;.tbError.Text = e.Error.ToString();&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;

  &lt;br /&gt;&lt;/div&gt;

&lt;p&gt;&lt;font size="2"&gt;Before proceeding, let’s take a look at what the above code does.&lt;/font&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;font size="2"&gt;The xaml definition of the SignInButton control specifies the scopes that the app needs to ask user permissions for. We’re including 3 scopes here: wl.sign, wl.basic and wl.offline_access. Together these 3 scopes give the app access to user’s basic profile information and allows the app to access data even when the user is not actively using the app. For more information on Live Connect scopes, read &lt;a href="http://msdn.microsoft.com/en-us/library/hh243646.aspx"&gt;here&lt;/a&gt;. In addition, the documentation you can download from the Live SDK download site includes updated information on this release.&lt;/font&gt; &lt;/li&gt;

  &lt;li&gt;&lt;font size="2"&gt;The xaml definition also adds an event handler for the SessionChanged event on the SignInButton. This event is fired when the sign-in process has finished.&lt;/font&gt; &lt;/li&gt;

  &lt;li&gt;&lt;font size="2"&gt;If access is granted and the LiveConnectSession object indicates the LiveConnectSessionStatus as Connected, a new instance of the LiveConnectClient class is created with the current Session object.&lt;/font&gt; &lt;/li&gt;

  &lt;li&gt;&lt;font size="2"&gt;In the function GetMe(), the code talks to the &lt;a href="http://msdn.microsoft.com/en-us/library/hh243648.aspx"&gt;Live Connect REST API&lt;/a&gt; to retrieve user’s basic profile information by calling LiveConnectClient.GetAsync on “me”.&lt;/font&gt; &lt;/li&gt;

  &lt;li&gt;&lt;font size="2"&gt;When the result comes back, the GetCompleted event on LiveConnectClient is fired, the app can then obtain user’s first and last names through the e.Result IDictionary object.&lt;/font&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;font size="2"&gt;7. Before you can run the app, you need to provision it with Live Connect. Go to the &lt;a href="https://manage.dev.live.com"&gt;application management site&lt;/a&gt; and &lt;/font&gt;&lt;font size="2"&gt;click the &lt;/font&gt;&lt;a href="https://manage.dev.live.com/AddApplication.aspx"&gt;&lt;font size="2"&gt;Create Application&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt; link. Create an application called HelloWorldPhone.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/6036.PhoneNewApp_5F00_4F81B646.png"&gt;&lt;img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="PhoneNewApp" border="0" alt="PhoneNewApp" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/7827.PhoneNewApp_5F00_thumb_5F00_615E4A13.png" width="545" height="254" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;8. After you click “I accept”, an application is created for you with a client id and a client secret (values removed for discretion).&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/3125.PhoneAppCreated_5F00_082C6054.png"&gt;&lt;img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="PhoneAppCreated" border="0" alt="PhoneAppCreated" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/4784.PhoneAppCreated_5F00_thumb_5F00_68115396.png" width="547" height="201" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;9. Go to Application Settings Page and click on the API Settings tab. Check “Yes” for “Mobile client app” and save.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/5355.PhoneAppCreated_5F00_2E8E439F.png"&gt;&lt;img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="PhoneAppCreated" border="0" alt="PhoneAppCreated" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/1663.PhoneAppCreated_5F00_thumb_5F00_7981B46E.png" width="555" height="204" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;10. The app is now provisioned and ready to go. Go back to your MainPage.xaml, and add the ClientId property on the SignInButton. &lt;/font&gt;&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;my:SignInButton&lt;/span&gt; &lt;span class="attr"&gt;Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;btnLogin&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;ClientId&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;[Your Client ID here]&amp;quot; &lt;/span&gt;&lt;span class="attr"&gt;HorizontalAlignment&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Left&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;SessionChanged&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;btnLogin_SessionChanged&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Scopes&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;wl.signin wl.basic wl.offline_access&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;&lt;font size="2"&gt;11. You’re done. Hit F5 and run the app in the emulator. Click the “Sign In” button and type in a username and password to sign into Windows Live. Next y&lt;/font&gt;&lt;font size="2"&gt;ou will see a screen asking user permission to access data.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/7024.PhoneConsent_5F00_0753FA6A.png"&gt;&lt;img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="PhoneConsent" border="0" alt="PhoneConsent" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/1651.PhoneConsent_5F00_thumb_5F00_471DE0EF.png" width="255" height="450" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;13. Click Yes. Notice that the SignInButton has changed to “Sign Out” state and a greetings with your name is displayed. &lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/3113.PhoneSuccess_5F00_3FFEA477.png"&gt;&lt;img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="PhoneSuccess" border="0" alt="PhoneSuccess" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/6740.PhoneSuccess_5F00_thumb_5F00_4DD0EA72.png" width="260" height="150" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;14. At this point, the app can continue to access user data until user signs out or until the refresh token is expired. A refresh token is valid for one year and is reset every time a new access token is issued. The user will not be asked for credentials again as long as the app is activated at least once a year.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;For more Live Connect code samples, visit our github site at &lt;a title="https://github.com/liveservices/livesdk" href="https://github.com/liveservices/livesdk"&gt;https://github.com/liveservices/livesdk&lt;/a&gt;.&lt;/font&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10380786" width="1" height="1"&gt;</content><author><name>Shelly Guo</name><uri>http://blogs.msdn.com/shellyguo_4000_live.com/ProfileUrlRedirect.ashx</uri></author></entry><entry><title>Get started on Live SDK for Windows Phone</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/shelly_guos_ms_blog/archive/2011/09/20/get-started-on-live-sdk-for-windows-phone.aspx" /><id>http://blogs.msdn.com/b/shelly_guos_ms_blog/archive/2011/09/20/get-started-on-live-sdk-for-windows-phone.aspx</id><published>2011-09-20T05:35:10Z</published><updated>2011-09-20T05:35:10Z</updated><content type="html">&lt;p&gt;&lt;em&gt;[Update on 12/26/2012] Live SDK&lt;/em&gt;&lt;em&gt; 5.3 is now available on &lt;/em&gt;&lt;a href="http://dev.live.com/"&gt;&lt;em&gt;Live Connect Developer Center&lt;/em&gt;&lt;/a&gt;&lt;em&gt;! Many new features in this release, most notably new .Net SDKs for both classic desktop and Asp.Net. It also include an updated Windows Phone SDK targeting the new Windows Phone 8.&amp;#160; Even better, all our SDKs including the Windows and Windows Phone SDKs are now open source. Check out our &lt;a title="Live SDK github depot" href="https://github.com/liveservices"&gt;LiveServices github depot&lt;/a&gt;, download the source code and party.&amp;#160; This post is now updated to use code samples for Windows Phone 8.&amp;#160; If you are looking for the starter guide for Windows Phone 7.x, please refer to the &lt;a title="Get started on Live SDK for Windows Phone 7.x" href="http://blogs.msdn.com/b/shelly_guos_ms_blog/archive/2012/12/26/getting-started-on-live-sdk-for-windows-phone-7-x.aspx"&gt;older post&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;a href="http://msdn.microsoft.com/en-us/windowslive/default"&gt;&lt;font size="2"&gt;Live Connect&lt;/font&gt;&lt;/a&gt; provides developers a set of controls and APIs that enable applications to integrate sign-in with the user’s Microsoft account and access user information stored in Windows services such as &lt;a title="SkyDrive home" href="https://skydrive.live.com"&gt;SkyDrive&lt;/a&gt; and &lt;a title="outlook.com" href="https://outlook.live.com"&gt;Hotmail&lt;/a&gt;.&lt;/font&gt;&lt;font size="2"&gt; In this post, I will walk through the steps for creating a simple Live Connect powered Windows Phone application.&lt;/font&gt; Once you get you app started with the basic stuff, you can move on to learn more about our &lt;a title="SkyDrive API Documentation" href="http://msdn.microsoft.com/en-us/library/live/hh826521"&gt;SkyDrive API&lt;/a&gt; and how to use it to &lt;a title="Developer&amp;#39;s guide to the SkyDrive API" href="http://channel9.msdn.com/Events/Build/2012/3-139"&gt;cloud power your application&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;A few words on the behind the scene stuff before I start the step-by-step guide. When building Windows Store apps on Windows 8, Single-Sign-On (SSO) is achieved with support from the OS. (To learn more about how to implement SSO for Windows Store apps, check out our &lt;a href="http://channel9.msdn.com/Events/Build/2012/3-138"&gt;//BUILD 2012 talk&lt;/a&gt; or my blog post for “&lt;a href="http://blogs.msdn.com/b/shelly_guos_ms_blog/archive/2012/12/26/powering-your-windows-8-apps-and-websites-with-microsoft-accounts.aspx"&gt;Powering your apps and websites with Microsoft accounts&lt;/a&gt;”.) On Windows Phone, however, such support is not available for third party apps. To provide a good sign-in experience on mobile devices, Live Connect allows a mobile client to obtain a refresh token and use it to exchange for an access token. This provides a way for mobile clients to implement a Sign-In-Once experience and avoid the need to ask user for password every time the app is activated. To opt-in for this experience, your app needs to satisfy two criteria: &lt;/font&gt;&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;font size="2"&gt;The app must be provisioned as a mobile app.&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="2"&gt;User must grant the app offline access permission. &lt;/font&gt;&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&lt;font size="2"&gt;We will discuss the details on how to meet these two criteria in the following step-by-step guide.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Pre-requisite:&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font size="2"&gt;Download and&lt;font color="#000000"&gt; install &lt;/font&gt;&lt;a href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;amp;id=27153"&gt;&lt;font color="#000000"&gt; the&lt;/font&gt;&lt;/a&gt;&lt;font color="#000000"&gt; latest Windows Phone Developer Tools from &lt;a title="Windows Phone developer center" href="https://dev.windowsphone.com"&gt;Windows Phone developer center&lt;/a&gt;.&lt;/font&gt;&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="2"&gt;Download and install &lt;a href="http://msdn.microsoft.com/en-us/live/ff621310"&gt;Live SDK&lt;/a&gt;.&lt;/font&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;font size="2"&gt;Let’s start by creating a new Windows Phone application. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;1. Create a new HelloWorldPhone Windows Phone application in Microsoft Visual Studio 2010 or Microsoft Visual Studio 2010 Express for Windows Phone using the Visual C# -&amp;gt; Silverlight for Windows Phone -&amp;gt; Windows Phone Application project template. Choose Windows Phone 8.0 as your target platform.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/0842.image_5F00_thumb2_5F00_thumb_5F00_79D62F63.png"&gt;&lt;img style="margin: 0px; border: 0px currentcolor; display: inline; background-image: none;" title="image_thumb2_thumb" border="0" alt="image_thumb2_thumb" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/7360.image_5F00_thumb2_5F00_thumb_5F00_thumb_5F00_008938E7.png" width="667" height="463" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;2. Bring up the Add Reference dialog and go to the Assemblies –&amp;gt; extensions tab. Find the Microsoft.Live and Microsoft.Live.Controls assemblies. Add them to your project.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/3162.image_5F00_thumb4_5F00_thumb_5F00_5544A1DF.png"&gt;&lt;img style="margin: 0px; border: 0px currentcolor; display: inline; background-image: none;" title="image_thumb4_thumb" border="0" alt="image_thumb4_thumb" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/0523.image_5F00_thumb4_5F00_thumb_5F00_thumb_5F00_150E8865.png" width="677" height="469" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;3. Open MainPage.xaml in the designer. Bring the Toolbox in view and right-click to select Choose Items… Under Windows Phone Components tab, find the SignInButton control in the Microsoft.Live.Control namespace and add to your toolbox (You only need to do this once). You will see two entries here, choose the one that’s for Windows Phone 8 by examining the directory of the component dll. It should be something like C:\Program Files (x86)\Microsoft SDKs\Live\v5.0\Windows Phone 8.0\References.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/4336.image_5F00_thumb7_5F00_thumb_5F00_54D86EEA.png"&gt;&lt;img style="margin: 0px; border: 0px currentcolor; display: inline; background-image: none;" title="image_thumb7_thumb" border="0" alt="image_thumb7_thumb" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/5635.image_5F00_thumb7_5F00_thumb_5F00_thumb_5F00_14A25570.png" width="677" height="469" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;The SignInButton control should now show up in your toolbox.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/4377.PhoneToolBoxItem_5F00_61CA7D08.png"&gt;&lt;img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="PhoneToolBoxItem" border="0" alt="PhoneToolBoxItem" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/2234.PhoneToolBoxItem_5F00_thumb_5F00_41AF704B.png" width="244" height="144" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;4. Drag the SignInButton onto your designer surface. In your xaml file, change the generated xml for the SignInButton to the following:&lt;/font&gt;&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Controls:SignInButton&lt;/span&gt; &lt;span class="attr"&gt;Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;btnLogin&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Scopes&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;wl.signin wl.basic wl.offline_access&amp;quot;&lt;/span&gt; &lt;/pre&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="attr"&gt;SessionChanged&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;btnLogin_SessionChanged&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;HorizontalAlignment&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Left&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Margin&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;155,217,0,0&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;VerticalAlignment&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Top&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;&lt;font size="2"&gt;5. Add a couple TextBlock elements to display the greeting and the error message (in case something goes wrong). Here’s the complete xaml for &lt;/font&gt;&lt;/p&gt;


&lt;div style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: rgb(244, 244, 244);" id="codeSnippetWrapper"&gt;
  &lt;div style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);" id="codeSnippet"&gt;
    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;phone:PhoneApplicationPage&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;    &lt;span style="color: rgb(255, 0, 0);"&gt;xmlns&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;    &lt;span style="color: rgb(255, 0, 0);"&gt;xmlns:x&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;    &lt;span style="color: rgb(255, 0, 0);"&gt;xmlns:phone&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;    &lt;span style="color: rgb(255, 0, 0);"&gt;xmlns:shell&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;    &lt;span style="color: rgb(255, 0, 0);"&gt;xmlns:d&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;http://schemas.microsoft.com/expression/blend/2008&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;    &lt;span style="color: rgb(255, 0, 0);"&gt;xmlns:mc&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;http://schemas.openxmlformats.org/markup-compatibility/2006&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;    &lt;span style="color: rgb(255, 0, 0);"&gt;xmlns:Controls&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;clr-namespace:Microsoft.Live.Controls;assembly=Microsoft.Live.Controls&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;    &lt;span style="color: rgb(255, 0, 0);"&gt;x:Class&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;HelloWorldPhone.MainPage&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;    &lt;span style="color: rgb(255, 0, 0);"&gt;mc:Ignorable&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;d&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;    &lt;span style="color: rgb(255, 0, 0);"&gt;FontFamily&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;{StaticResource PhoneFontFamilyNormal}&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;    &lt;span style="color: rgb(255, 0, 0);"&gt;FontSize&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;{StaticResource PhoneFontSizeNormal}&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;    &lt;span style="color: rgb(255, 0, 0);"&gt;Foreground&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;{StaticResource PhoneForegroundBrush}&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;    &lt;span style="color: rgb(255, 0, 0);"&gt;SupportedOrientations&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;Portrait&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Orientation&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;Portrait&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;    &lt;span style="color: rgb(255, 0, 0);"&gt;shell:SystemTray&lt;/span&gt;.&lt;span style="color: rgb(255, 0, 0);"&gt;IsVisible&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;True&amp;quot;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;    &lt;span style="color: rgb(0, 128, 0);"&gt;&amp;lt;!--LayoutRoot is the root grid where all page content is placed--&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;    &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;Grid&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;x:Name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;LayoutRoot&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Background&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;Transparent&amp;quot;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;RowDefinition&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Height&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;Auto&amp;quot;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;RowDefinition&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Height&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;*&amp;quot;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        &lt;span style="color: rgb(0, 128, 0);"&gt;&amp;lt;!--TitlePanel contains the name of the application and page title--&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;StackPanel&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;x:Name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;TitlePanel&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Grid&lt;/span&gt;.&lt;span style="color: rgb(255, 0, 0);"&gt;Row&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;0&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Margin&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;12,17,0,28&amp;quot;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;TextBlock&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Text&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;Hello World&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Margin&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;9,-7,0,0&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Style&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;{StaticResource PhoneTextTitle1Style}&amp;quot;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;StackPanel&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;        &lt;span style="color: rgb(0, 128, 0);"&gt;&amp;lt;!--ContentPanel - place additional content here--&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;Grid&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;x:Name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;ContentPanel&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Grid&lt;/span&gt;.&lt;span style="color: rgb(255, 0, 0);"&gt;Row&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;1&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Margin&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;12,0,12,0&amp;quot;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;Controls:SignInButton&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;ClientId&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;[Enter your Client ID]&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Scopes&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;wl.signin wl.basic wl.offline_access&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;Left&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Margin&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;10,10,0,0&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;Top&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;SessionChanged&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;btnLogin_SessionChanged&amp;quot;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;TextBlock&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;x:Name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;tbGreeting&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Text&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;Hello &amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;Left&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Margin&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;24,149,0,0&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;TextWrapping&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;Wrap&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;Top&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Height&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;82&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Width&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;394&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;FontSize&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;36&amp;quot;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;TextBlock&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;x:Name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;tbError&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;Left&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Margin&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;24,397,0,0&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;TextWrapping&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;Wrap&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;Top&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Height&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;82&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Width&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;394&amp;quot;&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;FontSize&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=&amp;quot;36&amp;quot;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;Grid&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;    &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;Grid&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;phone:PhoneApplicationPage&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&lt;font size="2"&gt;6. Add the following code in your MainPage.xaml.cs file.&lt;/font&gt;&lt;/p&gt;

&lt;div style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: rgb(244, 244, 244);" id="codeSnippetWrapper"&gt;
  &lt;div style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);" id="codeSnippet"&gt;
    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt; System;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt; Microsoft.Phone.Controls;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt; Microsoft.Live;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt; Microsoft.Live.Controls;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;namespace&lt;/span&gt; HelloWorldPhone&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;{&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;    &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;partial&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; MainPage : PhoneApplicationPage&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt; LiveConnectClient liveClient;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; MainPage()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            InitializeComponent();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt; btnLogin_SessionChanged(&lt;span style="color: rgb(0, 0, 255);"&gt;object&lt;/span&gt; sender, LiveConnectSessionChangedEventArgs e)        &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;        {            &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt; (e != &lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt; &amp;amp;&amp;amp; e.Status == LiveConnectSessionStatus.Connected)            &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            {                &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;                &lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;.liveClient = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; LiveConnectClient(e.Session);                &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                &lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;.GetMe();            &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;            }            &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;else&lt;/span&gt;            &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;            {                &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                &lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;.liveClient = &lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt;;                &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;                &lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;.tbError.Text = e.Error != &lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt; ? e.Error.ToString() : &lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;.Empty;            &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            }        &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        }        &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;        &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt; async &lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt; GetMe()        &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;        {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;try&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;                LiveOperationResult operationResult = await &lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;.liveClient.GetAsync(&lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;me&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                var jsonResult = operationResult.Result &lt;span style="color: rgb(0, 0, 255);"&gt;as&lt;/span&gt; dynamic;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;                &lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt; firstName = jsonResult.first_name ?? &lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;.Empty;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;                &lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt; lastName = jsonResult.last_name ?? &lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;.Empty;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;                &lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;.tbGreeting.Text = &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot;Welcome &amp;quot;&lt;/span&gt; + firstName + &lt;span style="color: rgb(0, 96, 128);"&gt;&amp;quot; &amp;quot;&lt;/span&gt; + lastName;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;catch&lt;/span&gt; (Exception e)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;                &lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;.tbError.Text = e.ToString();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;            }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;        }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"&gt;    }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&lt;font size="2"&gt;Before proceeding, let’s take a look at what the above code does.&lt;/font&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;font size="2"&gt;The xaml definition of the SignInButton control specifies the scopes that the app needs to ask user permissions for. We’re including 3 scopes here: wl.sign, wl.basic and wl.offline_access. Together these 3 scopes give the app access to user’s basic profile information and allows the app to access data even when the user is not actively using the app. For more information on Live Connect scopes, read &lt;a href="http://msdn.microsoft.com/en-us/library/hh243646.aspx"&gt;here&lt;/a&gt;. &lt;/font&gt;&lt;/li&gt;

  &lt;li&gt;&lt;font size="2"&gt;The xaml definition also adds an event handler for the SessionChanged event on the SignInButton. This event is fired when the sign-in process has finished.&lt;/font&gt; &lt;/li&gt;

  &lt;li&gt;&lt;font size="2"&gt;If access is granted and the LiveConnectSession object indicates the LiveConnectSessionStatus as Connected, a new instance of the LiveConnectClient class is created with the current Session object.&lt;/font&gt; &lt;/li&gt;

  &lt;li&gt;&lt;font size="2"&gt;In the function GetMe(), the code talks to the &lt;a href="http://msdn.microsoft.com/en-us/library/hh243648.aspx"&gt;Live Connect REST API&lt;/a&gt; to retrieve user’s basic profile information by calling LiveConnectClient.GetAsync on “me”.&lt;/font&gt;&lt;font size="2"&gt;LiveConnectClient.Async is implemented as an async operation using the Task async pattern. use the keyword “await” to call this API.&lt;/font&gt;&lt;/li&gt;

  &lt;li&gt;&lt;font size="2"&gt;When the result comes back, the app can then obtain user’s first and last names through the operatonResult.Result IDictionary object. In this example, we cast operationResult.Result to a “dynamic” object so you can access the dictionary values through the .key syntax.&lt;/font&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;font size="2"&gt;7. Before you can run the app, you need to provision it with Live Connect. Go to the &lt;a href="https://manage.dev.live.com"&gt;application management site&lt;/a&gt; and &lt;/font&gt;&lt;font size="2"&gt;click the &lt;/font&gt;&lt;a href="https://manage.dev.live.com/AddApplication.aspx"&gt;&lt;font size="2"&gt;Create Application&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt; link. Create an application called HelloWorldPhone.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/6036.PhoneNewApp_5F00_4F81B646.png"&gt;&lt;img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="PhoneNewApp" border="0" alt="PhoneNewApp" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/7827.PhoneNewApp_5F00_thumb_5F00_615E4A13.png" width="545" height="254" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;8. After you click “I accept”, an application is created for you with a client id and a client secret (values removed for discretion).&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/3125.PhoneAppCreated_5F00_082C6054.png"&gt;&lt;img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="PhoneAppCreated" border="0" alt="PhoneAppCreated" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/4784.PhoneAppCreated_5F00_thumb_5F00_68115396.png" width="547" height="201" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;9. Go to Application Settings Page and click on the API Settings tab. Check “Yes” for “Mobile client app” and save.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/5355.PhoneAppCreated_5F00_2E8E439F.png"&gt;&lt;img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="PhoneAppCreated" border="0" alt="PhoneAppCreated" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/1663.PhoneAppCreated_5F00_thumb_5F00_7981B46E.png" width="555" height="204" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;10. The app is now provisioned and ready to go. Go back to your MainPage.xaml, and add the ClientId property on the SignInButton. &lt;/font&gt;&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;my:SignInButton&lt;/span&gt; &lt;span class="attr"&gt;Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;btnLogin&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;ClientId&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;[Your Client ID here]&amp;quot; &lt;/span&gt;&lt;span class="attr"&gt;HorizontalAlignment&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Left&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;SessionChanged&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;btnLogin_SessionChanged&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Scopes&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;wl.signin wl.basic wl.offline_access&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;&lt;font size="2"&gt;11. You’re done. Hit F5 and run the app in the emulator. Click the “Sign In” button and type in a username and password to sign into Windows Live. Next y&lt;/font&gt;&lt;font size="2"&gt;ou will see a screen asking user permission to access data.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/8372.image_5F00_thumb1_5F00_546C3BF5.png"&gt;&lt;img style="margin: 0px; border: 0px currentcolor; display: inline; background-image: none;" title="image_thumb1" border="0" alt="image_thumb1" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/0842.image_5F00_thumb1_5F00_thumb_5F00_4D4CFF7D.png" width="219" height="392" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;13. Click Yes. Notice that the SignInButton has changed to “Sign Out” state and a greetings with your name is displayed. &lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/8446.image_5F00_thumb21_5F00_7F44A007.png"&gt;&lt;img style="margin: 0px; border: 0px currentcolor; display: inline; background-image: none;" title="image_thumb2[1]" border="0" alt="image_thumb2[1]" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/0027.image_5F00_thumb21_5F00_thumb_5F00_5F29934A.png" width="244" height="226" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;14. At this point, the app can continue to access user data until user signs out or until the refresh token is expired. A refresh token is valid for one year and is reset every time a new access token is issued. The user will not be asked for credentials again as long as the app is activated at least once a year.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;For more Live Connect code samples, visit our github site at &lt;a title="https://github.com/liveservices/livesdk" href="https://github.com/liveservices/livesdk"&gt;https://github.com/liveservices/livesdk&lt;/a&gt;.&lt;/font&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10213885" width="1" height="1"&gt;</content><author><name>Shelly Guo</name><uri>http://blogs.msdn.com/shellyguo_4000_live.com/ProfileUrlRedirect.ashx</uri></author><category term="Live SDK" scheme="http://blogs.msdn.com/b/shelly_guos_ms_blog/archive/tags/Live+SDK/" /><category term="Live Connect" scheme="http://blogs.msdn.com/b/shelly_guos_ms_blog/archive/tags/Live+Connect/" /><category term="Windows Live Developer" scheme="http://blogs.msdn.com/b/shelly_guos_ms_blog/archive/tags/Windows+Live+Developer/" /><category term="Windows Phone" scheme="http://blogs.msdn.com/b/shelly_guos_ms_blog/archive/tags/Windows+Phone/" /></entry><entry><title>A Step-by-step guide to creating your first Hello World Metro style app using Live Connect, in C#</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/shelly_guos_ms_blog/archive/2011/09/16/a-step-by-step-guide-to-creating-your-first-hello-world-metro-style-app-using-live-connect-in-c.aspx" /><id>http://blogs.msdn.com/b/shelly_guos_ms_blog/archive/2011/09/16/a-step-by-step-guide-to-creating-your-first-hello-world-metro-style-app-using-live-connect-in-c.aspx</id><published>2011-09-16T13:29:00Z</published><updated>2011-09-16T13:29:00Z</updated><content type="html">&lt;p&gt;&lt;font size="2"&gt;In my previous &lt;a href="http://blogs.msdn.com/b/shelly_guos_ms_blog/archive/2011/09/16/a-step-by-step-guid-to-creating-your-first-hello-world-metro-style-app-using-live-connect.aspx"&gt;post&lt;/a&gt;, I showed how to create a Live Connect powered Windows Metro style app using JavaScript. In this post, I will go through the steps for creating the same app using C#. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;If you’re a VB developer, follow the same steps in this post but change the code behind to use VB.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family: georgia,palatino; font-size: small"&gt;&lt;font face="Segoe UI"&gt;If you’re a Windows Phone developer, this &lt;a href="http://blogs.msdn.com/b/shelly_guos_ms_blog/archive/2011/09/20/get-started-on-live-sdk-for-windows-phone.aspx"&gt;post&lt;/a&gt; is for you.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;If you haven’t downloaded and installed the &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/windows/apps/br229516"&gt;&lt;font size="2"&gt;Windows Developer Preview&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt;, you got to check it out.&amp;#160; It’s a brand new Windows unlike anything before.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;If you haven’t downloaded and installed the Live SDK, please do that before taking the following steps. &lt;/font&gt;&lt;a href="http://connect.microsoft.com/site1226/SelfNomination.aspx?ProgramID=7291&amp;amp;pageType=1"&gt;&lt;font size="2"&gt;Sign up for the Live Connect&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt; technical preview, download and install the LiveSDK.msi.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Sign into your new PC using a Live ID account.&amp;#160; If you must use a domain account or a local account, you can connect your domain or local account to a Live ID account through Control Panel -&amp;gt; Users, click “Connect your Windows Live ID” and following the instructions.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Now you’re ready.&amp;#160; Let’s write our first Metro style app in C# together.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;The Managed application UI framework for Metro style apps carries forward the WPF programming paradigm that most .Net UI developers are familiar with.&amp;#160; Application UI is defined in XAML and business logic is implemented in code behind using managed languages like C# and VB.&amp;#160; If you’ve worked with WPF or Silverlight, this should be very intuitive to you.&amp;#160; With that said, let see how we can add Live Connect to your app.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;1. Start Visual Studio 11 Express and create a new project called HelloWorldCSharp.&amp;#160; Choose the Visual C# -&amp;gt; Windows Metro style -&amp;gt; Application project template.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/4786.CSharpNewProj_5F00_45768B45.png"&gt;&lt;font size="3"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="CSharpNewProj" border="0" alt="CSharpNewProj" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/5543.CSharpNewProj_5F00_thumb_5F00_5A385DF8.png" width="599" height="495" /&gt;&lt;/font&gt;&lt;/a&gt;&lt;/p&gt; &lt;font size="3"&gt;&lt;/font&gt;  &lt;p&gt;2. &lt;font size="2"&gt;Bring up the “Add Reference” dialog and choose “Live SDK for Windows Metro style XAML applications” under the Windows -&amp;gt; Extension SDKs tab.&amp;#160; Click “Add” and then “Close”.&amp;#160; Notice that a reference to LiveSDKXAML SDK is added to you project.&amp;#160; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/5556.CSharpAddRef_5F00_1A02447E.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="CSharpAddRef" border="0" alt="CSharpAddRef" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/5531.CSharpAddRef_5F00_thumb_5F00_55C1DD31.png" width="612" height="506" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;3. &lt;font size="2"&gt;Now open the MainPage.xaml file.&amp;#160; Add the following attribute to the root UserControl tag&lt;/font&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font size="2"&gt;xmlns:live=&amp;quot;using:Microsoft.Live.Controls&amp;quot;&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;font size="2"&gt;This adds a namespace declaration for the sign-in control we will be using in this xaml file.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;4.&lt;font size="2"&gt; In the root &amp;lt;Grid&amp;gt; element, add a Canvas control that hosts the sign-in button and two TextBlock controls.&lt;/font&gt;&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Grid&lt;/span&gt; &lt;span class="attr"&gt;x:Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;LayoutRoot&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Background&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;#FF0C0C0C&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Canvas&lt;/span&gt; &lt;span class="attr"&gt;HorizontalAlignment&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Left&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Height&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;217&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Margin&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;100,100,0,0&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;VerticalAlignment&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Top&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Width&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;742&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;live:SignInButton&lt;/span&gt; &lt;span class="attr"&gt;Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;btnSignin&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Scopes&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;wl.signin wl.basic&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Margin&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;100,20,0,0&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Foreground&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;White&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Background&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Black&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;TextBlock&lt;/span&gt; &lt;span class="attr"&gt;Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;tbGreeting&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Margin&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;100,100,0,0&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Text&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Width&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;300&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Height&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;50&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;FontSize&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;32&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;TextBlock&lt;/span&gt; &lt;span class="attr"&gt;Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;tbError&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Margin&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;100,150,0,0&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Text&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Width&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;300&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Height&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;50&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;FontSize&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;32&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Canvas&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Grid&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;


&lt;p&gt;&lt;font size="2"&gt;&lt;em&gt;You will notice that adding the SignInButton control causes the designer to invalidate the xaml and fail to load. Unfortunately this is an issue that cannot be resolved in the Windows Developer Preview build of Visual Studio. Design time support for custom control is still absent in VS. To work around that, I replace the SignInButton with a regular Button control, do my design work and then replace the SignInButton back when I’m ready to run the app.&lt;/em&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;You will also notice that I have added the Scopes attribute to the SignInButton. The value “wl.signin wl.basic” indicates that this app will ask the user for permission to access his basic profile information. For more information about different scopes supported by Live Services, visit &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/hh243646.aspx"&gt;&lt;font size="2"&gt;here&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt;.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;5. Once we have the markup, now let’s go to MainPage.xaml.cs and add some code. This is what I have:&lt;/font&gt;&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt;  &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; Microsoft.Live;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; Microsoft.Live.Controls;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;  &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt; HelloWorldCSharp&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;partial&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; MainPage&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt;     {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; LiveConnectClient liveClient;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum11"&gt;  11:&lt;/span&gt;  &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum12"&gt;  12:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; MainPage()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum13"&gt;  13:&lt;/span&gt;         {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum14"&gt;  14:&lt;/span&gt;             InitializeComponent();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum15"&gt;  15:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.btnSignin.SessionChanged += OnSessionChanged;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum16"&gt;  16:&lt;/span&gt;         }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum17"&gt;  17:&lt;/span&gt;  &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum18"&gt;  18:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; OnSessionChanged(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; sender, LiveConnectSessionChangedEventArgs e)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum19"&gt;  19:&lt;/span&gt;         {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum20"&gt;  20:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (e.Session != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt; &amp;amp;&amp;amp; e.Session.Status == LiveConnectSessionStatus.Connected)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum21"&gt;  21:&lt;/span&gt;             {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum22"&gt;  22:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.liveClient = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; LiveConnectClient(e.Session);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum23"&gt;  23:&lt;/span&gt;  &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum24"&gt;  24:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.GetMe();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum25"&gt;  25:&lt;/span&gt;             }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum26"&gt;  26:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum27"&gt;  27:&lt;/span&gt;             {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum28"&gt;  28:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.liveClient = &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum29"&gt;  29:&lt;/span&gt;             }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum30"&gt;  30:&lt;/span&gt;         }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum31"&gt;  31:&lt;/span&gt;  &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum32"&gt;  32:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; GetMe()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum33"&gt;  33:&lt;/span&gt;         {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum34"&gt;  34:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.liveClient.GetCompleted += OnGetMe;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum35"&gt;  35:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.liveClient.GetAsync(&lt;span style="color: #006080"&gt;&amp;quot;me&amp;quot;&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum36"&gt;  36:&lt;/span&gt;         }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum37"&gt;  37:&lt;/span&gt;  &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum38"&gt;  38:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; OnGetMe(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; sender, LiveOperationCompletedEventArgs e)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum39"&gt;  39:&lt;/span&gt;         {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum40"&gt;  40:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.liveClient.GetCompleted -= OnGetMe;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum41"&gt;  41:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (e.Error == &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum42"&gt;  42:&lt;/span&gt;             {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum43"&gt;  43:&lt;/span&gt;                 dynamic result = e.Result;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum44"&gt;  44:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.tbGreeting.Text = &lt;span style="color: #006080"&gt;&amp;quot;Hello &amp;quot;&lt;/span&gt; + result.first_name + &lt;span style="color: #006080"&gt;&amp;quot; &amp;quot;&lt;/span&gt; + result.last_name;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum45"&gt;  45:&lt;/span&gt;             }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum46"&gt;  46:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum47"&gt;  47:&lt;/span&gt;             {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum48"&gt;  48:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.tbError.Text = e.Error.ToString();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum49"&gt;  49:&lt;/span&gt;             }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum50"&gt;  50:&lt;/span&gt;         }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum51"&gt;  51:&lt;/span&gt;     }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum52"&gt;  52:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&lt;font size="2"&gt;Let’s go through what’s happening here. &lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;font size="2"&gt;First, I add a OnSessionChanged event handler to the SignInButton’s SessionChanged event, right after InitializeComponent. When the user clicks the sign in button and gives consent to the app, the SessionChanged event is fired indicating user has successfully signed in.&lt;/font&gt; &lt;/li&gt;

  &lt;li&gt;&lt;font size="2"&gt;When the OnSessionChanged event handler is called, I create a new instance of LiveConnectClient class, passing in the Session object.&amp;#160; The session object contains the access token that the app needs to request data from Live Services.&lt;/font&gt; &lt;/li&gt;

  &lt;li&gt;&lt;font size="2"&gt;The LiveConnectClient class make it easy to call the &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/hh243648.aspx"&gt;&lt;font size="2"&gt;Live Service REST API&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt; and retrieve user data from the Window Live cloud. Here I’m retrieving the user’s basic profile information by calling GET on “me”.&amp;#160; “me” is a special token used to identify the current user.&amp;#160; You can retrieve other types of user data by passing in the relative url to the resource.&amp;#160; You can find out more about what data is available in the documentation file you download through the &lt;a href="http://connect.microsoft.com/site1226/SelfNomination.aspx?ProgramID=7291&amp;amp;pageType=1"&gt;Live Connect&lt;/a&gt; website.&lt;/font&gt; &lt;/li&gt;

  &lt;li&gt;&lt;font size="2"&gt;When the GET request complete, my event handler OnGetMe is called.&lt;/font&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;font size="2"&gt;6. We’re almost done.&amp;#160; Before you can run this app, you need to register it with Windows Live.&amp;#160; You can register your app by going to the &lt;/font&gt;&lt;a href="https://manage.dev.live.com/BUILD"&gt;&lt;font size="2"&gt;application management site&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt; and the following the instructions there.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;7. After your app is registered you’re ready to go.&amp;#160; Hit F5 in VS.&amp;#160; You will see that a sign-in button shows up. &lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/3487.WWASigninButton_5F00_158BC3B7.png"&gt;&lt;font size="2"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="WWASigninButton" border="0" alt="WWASigninButton" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/6840.WWASigninButton_5F00_thumb_5F00_47836441.png" width="194" height="88" /&gt;&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;&lt;em&gt;Wait, why is that busy cursor keeps whirling?&amp;#160; I know, but we’re working on it… For now, just ignore the busy cursor.&lt;/em&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;Click the button, a dialog comes up asking user if they would allow the app to access their data.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/4786.CSharpConsent_5F00_27685784.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="CSharpConsent" border="0" alt="CSharpConsent" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/4466.CSharpConsent_5F00_thumb_5F00_074D4AC7.png" width="535" height="314" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;8. &lt;font size="2"&gt;Click yes.&amp;#160; The dialog disappears and the sign-in button changes to “Sign Out” state.&amp;#160; At the same time a greeting is displayed with the user’s name.&amp;#160; Hey, your app has just successfully connected to Live and obtained the user’s profile information.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/2313.CSharpSuccess_5F00_151F90C2.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="CSharpSuccess" border="0" alt="CSharpSuccess" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/6445.CSharpSuccess_5F00_thumb_5F00_75048404.png" width="244" height="137" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;9.&lt;font size="2"&gt; Just like the JavaScript app we created in this &lt;/font&gt;&lt;a href="http://blogs.msdn.com/b/shelly_guos_ms_blog/archive/2011/09/16/a-step-by-step-guid-to-creating-your-first-hello-world-metro-style-app-using-live-connect.aspx"&gt;&lt;font size="2"&gt;post&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt;, the Single-Sign-On feature is also available in C# and VB.&amp;#160; Shut down the app, restart it and watch the sign in button change to “Sign Out” state automatically.&amp;#160; &lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;Hope this is helpful to get your first Live Connected app up and running.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;For more Live SDK samples, visit our github site at &lt;/font&gt;&lt;a title="https://github.com/liveservices/LiveSDK" href="https://github.com/liveservices/LiveSDK"&gt;&lt;font size="2"&gt;https://github.com/liveservices/LiveSDK&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt;.&lt;/font&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10212671" width="1" height="1"&gt;</content><author><name>Shelly Guo</name><uri>http://blogs.msdn.com/shellyguo_4000_live.com/ProfileUrlRedirect.ashx</uri></author><category term="Live SDK" scheme="http://blogs.msdn.com/b/shelly_guos_ms_blog/archive/tags/Live+SDK/" /><category term="Live Connect" scheme="http://blogs.msdn.com/b/shelly_guos_ms_blog/archive/tags/Live+Connect/" /><category term="SSO" scheme="http://blogs.msdn.com/b/shelly_guos_ms_blog/archive/tags/SSO/" /><category term="Windows Developer Preview" scheme="http://blogs.msdn.com/b/shelly_guos_ms_blog/archive/tags/Windows+Developer+Preview/" /><category term="Windows 8" scheme="http://blogs.msdn.com/b/shelly_guos_ms_blog/archive/tags/Windows+8/" /></entry><entry><title>A Step-by-step guide to creating your first Hello World Metro style app using Live Connect</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/shelly_guos_ms_blog/archive/2011/09/16/a-step-by-step-guid-to-creating-your-first-hello-world-metro-style-app-using-live-connect.aspx" /><id>http://blogs.msdn.com/b/shelly_guos_ms_blog/archive/2011/09/16/a-step-by-step-guid-to-creating-your-first-hello-world-metro-style-app-using-live-connect.aspx</id><published>2011-09-16T06:11:00Z</published><updated>2011-09-16T06:11:00Z</updated><content type="html">&lt;p&gt;&lt;span style="font-family: georgia,palatino; font-size: small"&gt;&lt;font face="Segoe UI"&gt;On Tuesday September 13&lt;sup&gt;rd&lt;/sup&gt;, together with the unveiling of the &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/windows/apps/br229516"&gt;&lt;font face="Segoe UI"&gt;Windows Developer Preview&lt;/font&gt;&lt;/a&gt;&lt;font face="Segoe UI"&gt;, our preview release of the Live SDK for &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/windowslive/default"&gt;&lt;font face="Segoe UI"&gt;Live Connect&lt;/font&gt;&lt;/a&gt;&lt;font face="Segoe UI"&gt; went public on the &lt;/font&gt;&lt;a href="http://connect.microsoft.com/"&gt;&lt;font face="Segoe UI"&gt;Microsoft Connect&lt;/font&gt;&lt;/a&gt;&lt;font face="Segoe UI"&gt; website.&amp;#160; The SDK includes a set of libraries that enable third party applications to connect with Windows Live and gain access to user’s profile as well as data stored in the Live cloud, including SkyDrive documents, Hotmail Contacts and Calendars, Messenger status, etc.&amp;#160; The libraries in the SDK support multiple platforms, including Windows Phone and Windows Metro style apps using JavaScript, C# and VB.&amp;#160; This will be the first of a series of how-to blogs that I will write about using the Live SDK and Live Connect for your apps.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family: georgia,palatino; font-size: small"&gt;&lt;font face="Segoe UI"&gt;In this first blog, I will go through the steps for creating your very first Live Connect powered Hello World Metro style app using JavaScript.&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family: georgia,palatino; font-size: small"&gt;&lt;font face="Segoe UI"&gt;If you’re a C# or VB developer, check out this &lt;a href="http://blogs.msdn.com/b/shelly_guos_ms_blog/archive/2011/09/16/a-step-by-step-guide-to-creating-your-first-hello-world-metro-style-app-using-live-connect-in-c.aspx"&gt;post&lt;/a&gt;.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family: georgia,palatino; font-size: small"&gt;&lt;font face="Segoe UI"&gt;If you’re a Windows Phone developer, this &lt;a href="http://blogs.msdn.com/b/shelly_guos_ms_blog/archive/2011/09/20/get-started-on-live-sdk-for-windows-phone.aspx"&gt;post&lt;/a&gt; is for you.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family: georgia,palatino; font-size: small"&gt;&lt;font face="Segoe UI"&gt;Let’s get started.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family: georgia,palatino; font-size: small"&gt;&lt;font face="Segoe UI"&gt;1.&amp;#160; Download and install &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/windows/apps/br229516"&gt;&lt;font face="Segoe UI"&gt;Windows Developer Preview&lt;/font&gt;&lt;/a&gt;&lt;font face="Segoe UI"&gt; following the instructions on the website.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family: georgia,palatino; font-size: small"&gt;&lt;font face="Segoe UI"&gt;2.&amp;#160; Once your machine is all set up and ready to go, sign into your PC using a Live ID account.&amp;#160; If you must use a domain account or a local account, you can connect your domain or local account to a Live ID account through Control Panel -&amp;gt; Users, click “Connect your Windows Live ID” and following the instructions.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family: georgia,palatino; font-size: small"&gt;&lt;font face="Segoe UI"&gt;3.&amp;#160; &lt;/font&gt;&lt;a href="http://connect.microsoft.com/site1226/SelfNomination.aspx?ProgramID=7291&amp;amp;pageType=1"&gt;&lt;font face="Segoe UI"&gt;Sign up for the Live Connect&lt;/font&gt;&lt;/a&gt;&lt;font face="Segoe UI"&gt; technical preview.&amp;#160; Live Connect provides developers a set of controls and APIs that enable applications to integrate Single Sign On (SSO) with Microsoft connected accounts and enable users to access information from SkyDrive, Hotmail, and Messenger.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family: georgia,palatino; font-size: small"&gt;&lt;font face="Segoe UI"&gt;4.&amp;#160; Install the Live SDK by downloading and running LiveSDK.msi from the website.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family: georgia,palatino; font-size: small"&gt;&lt;font face="Segoe UI"&gt;5.&amp;#160; Start Visual Studio 11 Express and create a new project called HelloWorldWWA.&amp;#160; Choose the JavaScript -&amp;gt; Windows Metro style -&amp;gt; Blank Application project template.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family: georgia,palatino; font-size: small"&gt;&lt;i&gt;&lt;font face="Segoe UI"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Tip: you can search for any installed programs by typing the program name in the start screen.&lt;/font&gt;&lt;/i&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family: georgia,palatino"&gt;&lt;span style="font-size: small"&gt;&lt;i&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-92/6204.WWANewProj.PNG"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-92/6204.WWANewProj.PNG" /&gt;&lt;/a&gt;&lt;/i&gt;&lt;/span&gt;&lt;span style="font-size: small"&gt;&lt;i&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family: georgia,palatino"&gt;&lt;font size="2" face="Segoe UI"&gt;6.&amp;#160; Bring up the “Add Reference” dialog and choose “Live SDK for Windows Metro style HTML applications” under the Windows -&amp;gt; Extension SDKs tab.&amp;#160; Click “Add” and then “Close”.&amp;#160; Notice that a reference to LiveSDKHTML SDK is added to your project. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family: georgia,palatino; font-size: small"&gt;&lt;i&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-92/8585.WWAAddRef.PNG"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-92/8585.WWAAddRef.PNG" /&gt;&lt;/a&gt;&lt;/i&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family: georgia,palatino"&gt;&lt;font size="2" face="Segoe UI"&gt;Expand the LiveSDKHTML reference node and you will see under the js node, a reference to wl.js file is added.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family: georgia,palatino; font-size: small"&gt;&lt;i&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-92/0676.WWAProjectRef.PNG"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/250x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-92/0676.WWAProjectRef.PNG" /&gt;&lt;/a&gt;&lt;/i&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family: georgia,palatino"&gt;7.&amp;#160; &lt;font size="2" face="Segoe UI"&gt;Now open the default.html file.&amp;#160; Add the following script tag to the header:&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family: courier new,courier; font-size: small"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;script src=&amp;quot;ms-wwa:///LiveSDKHTML.5.0/js/wl.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family: georgia,palatino"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;font size="2" face="Segoe UI"&gt;This adds the reference to wl.js in the html file.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family: georgia,palatino"&gt;&lt;font size="2" face="Segoe UI"&gt;8.&amp;#160; In the body of default.html, add the following HTML markup.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&amp;lt;body&amp;gt;&lt;br /&gt;    &amp;lt;div &lt;span style="color: #0000ff"&gt;class&lt;/span&gt;=&lt;span style="color: #006080"&gt;&amp;quot;signin_button&amp;quot;&lt;/span&gt; id=&lt;span style="color: #006080"&gt;&amp;quot;signin&amp;quot;&lt;/span&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;    &amp;lt;div &lt;span style="color: #0000ff"&gt;class&lt;/span&gt;=&lt;span style="color: #006080"&gt;&amp;quot;greeting&amp;quot;&lt;/span&gt; id=&lt;span style="color: #006080"&gt;&amp;quot;greeting&amp;quot;&lt;/span&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;    &amp;lt;div &lt;span style="color: #0000ff"&gt;class&lt;/span&gt;=&lt;span style="color: #006080"&gt;&amp;quot;error&amp;quot;&lt;/span&gt; id=&lt;span style="color: #006080"&gt;&amp;quot;info&amp;quot;&lt;/span&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;script&amp;gt;&lt;br /&gt;        WL.Event.subscribe(&lt;span style="color: #006080"&gt;&amp;quot;auth.login&amp;quot;&lt;/span&gt;, onLoginComplete);&lt;br /&gt;        WL.init();&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; scopes = [&lt;span style="color: #006080"&gt;&amp;quot;wl.signin&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;wl.basic&amp;quot;&lt;/span&gt;];&lt;br /&gt;        WL.ui({&lt;br /&gt;            name: &lt;span style="color: #006080"&gt;&amp;quot;signin&amp;quot;&lt;/span&gt;,&lt;br /&gt;            element: &lt;span style="color: #006080"&gt;&amp;quot;signin&amp;quot;&lt;/span&gt;,&lt;br /&gt;            scope: scopes&lt;br /&gt;        });&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; onLoginComplete(session) {&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (!session.error) {&lt;br /&gt;                WL.api({&lt;br /&gt;                    path: &lt;span style="color: #006080"&gt;&amp;quot;me&amp;quot;&lt;/span&gt;,&lt;br /&gt;                    method: &lt;span style="color: #006080"&gt;&amp;quot;GET&amp;quot;&lt;/span&gt;,&lt;br /&gt;                }, onAPICalled);&lt;br /&gt;            }&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;else&lt;/span&gt; {&lt;br /&gt;                document.getElementById(&lt;span style="color: #006080"&gt;&amp;quot;info&amp;quot;&lt;/span&gt;).innerText =&lt;br /&gt;                    &lt;span style="color: #006080"&gt;&amp;quot;Error signing in: &amp;quot;&lt;/span&gt; + session.error;&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; onAPICalled(result) {&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (!result.error) {&lt;br /&gt;                document.getElementById(&lt;span style="color: #006080"&gt;&amp;quot;greeting&amp;quot;&lt;/span&gt;).innerText =&lt;br /&gt;                    &lt;span style="color: #006080"&gt;&amp;quot;Hello, &amp;quot;&lt;/span&gt; + result.first_name + &lt;span style="color: #006080"&gt;&amp;quot; &amp;quot;&lt;/span&gt; + result.last_name + &lt;span style="color: #006080"&gt;&amp;quot;!&amp;quot;&lt;/span&gt;;&lt;br /&gt;            }&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;else&lt;/span&gt; {&lt;br /&gt;                document.getElementById(&lt;span style="color: #006080"&gt;&amp;quot;info&amp;quot;&lt;/span&gt;).innerText =&lt;br /&gt;                    &lt;span style="color: #006080"&gt;&amp;quot;Error getting info: &amp;quot;&lt;/span&gt; + result.error;&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    &amp;lt;/script&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&lt;/pre&gt;

  &lt;br /&gt;&lt;/div&gt;

&lt;p&gt;&lt;span style="font-family: georgia,palatino"&gt;&amp;#160;&amp;#160; &lt;font size="2" face="Segoe UI"&gt;The 3 div elements provide hosting surface to the sign-in button, the greeting and the error message (if anything goes wrong).&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span style="font-family: georgia,palatino"&gt;&lt;font size="2" face="Segoe UI"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; The code inside the script tag does the following things:&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;font size="2"&gt;Subscribe to the auth.login event (WL.Event.subscribe()).&amp;#160; The event is fired when user logs into Windows Live and grants consent to your application. &lt;/font&gt;&lt;/li&gt;

  &lt;li&gt;&lt;font size="2"&gt;Initializes WL (WL.init()), the JS library for Live Connect. &lt;/font&gt;&lt;/li&gt;

  &lt;li&gt;&lt;font size="2"&gt;Creates the sign-in button (WL.ui()) with a list of scopes that the app needs to request user consent for. &lt;/font&gt;&lt;/li&gt;

  &lt;li&gt;&lt;font size="2"&gt;When login completes, the onLoginComplete is invoked.&amp;#160; The app then makes a call to Live Services REST API via WL.api() to retrieve the user profile.&amp;#160;&amp;#160; &lt;/font&gt;&lt;/li&gt;

  &lt;li&gt;&lt;font size="2"&gt;When the api() call completes, the app can obtain the user’s profile information through the JSON object passed in to the callback function, in this case, the result object passed to the onAPICalled callback. &lt;/font&gt;&lt;/li&gt;

  &lt;li&gt;&lt;font size="2"&gt;The app greets the user by displaying their first and last names. &lt;/font&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;span style="font-family: georgia,palatino"&gt;&lt;font size="2" face="Segoe UI"&gt;9.&amp;#160; We’re almost there.&amp;#160; Before you can run this app, you need to register it with Windows Live.&amp;#160; You can register your app by going to the &lt;/font&gt;&lt;a href="https://manage.dev.live.com/BUILD"&gt;&lt;font size="2" face="Segoe UI"&gt;application management site&lt;/font&gt;&lt;/a&gt;&lt;font size="2" face="Segoe UI"&gt; and the following the instructions there.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span style="font-family: georgia,palatino"&gt;&lt;font size="2" face="Segoe UI"&gt;10.&amp;#160; The last optional step is to add some css style to your div elements.&amp;#160; Here’s a basic example.&amp;#160; In you default.css file, add the following:&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;.signin_button&lt;br /&gt;{&lt;br /&gt;    margin-left: 100px;&lt;br /&gt;    margin-top: 100px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.greeting&lt;br /&gt;{&lt;br /&gt;    margin-left: 100px;&lt;br /&gt;    margin-top: 50px;    &lt;br /&gt;    font-weight:bold;&lt;br /&gt;    font-size: x-large;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.error&lt;br /&gt;{&lt;br /&gt;    margin-left: 100px;&lt;br /&gt;    margin-top: 20px;&lt;br /&gt;    font-size: large;    &lt;br /&gt;}&lt;/pre&gt;

  &lt;br /&gt;&lt;/div&gt;

&lt;p&gt;&lt;span style="font-family: georgia,palatino"&gt;&lt;i&gt;&lt;font size="2" face="Segoe UI"&gt;Tip: Visual Studio does not support editing html through a visual designer, but you can view and edit the visuals through Microsoft Expression Blend 5 included in the Windows Developer Preview.&amp;#160; Start Blend and open the sample project.&amp;#160; You will see that the default.html file looks like the following in Blend’s designer view (the greeting and error strings are added only to show the visual effects in the designer).&lt;/font&gt;&lt;/i&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/6170.WWABlend_5F00_55AC078D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="WWABlend" border="0" alt="WWABlend" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-93-metablogapi/0334.WWABlend_5F00_thumb_5F00_476D8E9D.png" width="576" height="390" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;span style="font-family: georgia,palatino"&gt;&lt;font size="2" face="Segoe UI"&gt;11.&amp;#160; Now let’s run it.&amp;#160; Hit F5 in VS.&amp;#160; You will see that a sign-in button shows up.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span style="font-family: georgia,palatino"&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-92/0576.WWASigninButton.png"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/200x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-92/0576.WWASigninButton.png" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span style="font-family: georgia,palatino"&gt;&lt;font size="2" face="Segoe UI"&gt;Click the button, a dialog comes up asking user if they would allow the app to access their data.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span style="font-family: georgia,palatino"&gt;&amp;#160;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-92/5342.WWAConsent.png"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-92/5342.WWAConsent.png" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span style="font-family: georgia,palatino"&gt;&lt;font size="2" face="Segoe UI"&gt;12.&amp;#160; Click yes.&amp;#160; The dialog disappears and the sign-in button changes to “Sign Out” state.&amp;#160; At the same time a greeting is displayed with the user’s name.&amp;#160; Voila, your app has just successfully connected to Live and obtained user profile information from Live Services.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span style="font-family: georgia,palatino"&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-92/0272.WWASuccess.png"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x250/__key/communityserver-blogs-components-weblogfiles/00-00-01-47-92/0272.WWASuccess.png" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;13.&amp;#160; Now here’s the best part.&amp;#160; Shut down the app, without changing anything, restart it.&amp;#160; You’ll notice that after loading, the sign-in button automatically switches to “Sign Out” state and the greeting is displayed.&amp;#160; This is what we call the Single-Sign-On for third party apps feature.&amp;#160; It enables the app to do instant personalization without user having to do anything, as long as he has consented to allow the app to access to his data.&amp;#160; Now, that’s cool!&amp;#160; Think about all the things you can do to personalize your app for the user with zero clicks.&amp;#160; This cool new feature will make your app piping hot… 
    &lt;br /&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;For more Live SDK samples, visit our github site at &lt;/font&gt;&lt;a title="https://github.com/liveservices/LiveSDK" href="https://github.com/liveservices/LiveSDK"&gt;&lt;font size="2"&gt;https://github.com/liveservices/LiveSDK&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt;.&lt;/font&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10212217" width="1" height="1"&gt;</content><author><name>Shelly Guo</name><uri>http://blogs.msdn.com/shellyguo_4000_live.com/ProfileUrlRedirect.ashx</uri></author><category term="Live SDK" scheme="http://blogs.msdn.com/b/shelly_guos_ms_blog/archive/tags/Live+SDK/" /><category term="Live Connect" scheme="http://blogs.msdn.com/b/shelly_guos_ms_blog/archive/tags/Live+Connect/" /><category term="SSO" scheme="http://blogs.msdn.com/b/shelly_guos_ms_blog/archive/tags/SSO/" /><category term="Windows Developer Preview" scheme="http://blogs.msdn.com/b/shelly_guos_ms_blog/archive/tags/Windows+Developer+Preview/" /><category term="Windows 8" scheme="http://blogs.msdn.com/b/shelly_guos_ms_blog/archive/tags/Windows+8/" /></entry></feed>