<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Nisha Singh</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/nishasingh/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/nishasingh/feed.xml</link>
    <description>Developer Evangelist at Microsoft for Windows 8</description>
    <lastBuildDate>Wed, 17 Apr 2019 04:05:36 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Authenticating with TFS Connect and TFS Dashboard</title>
      <link>https://docs.microsoft.com/archive/blogs/nishasingh/authenticating-with-tfs-connect-and-tfs-dashboard</link>
      <pubDate>Fri, 15 Feb 2013 14:43:36 GMT</pubDate>
      <dc:creator><![CDATA[Nisha Singh]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/nishasingh/2013/02/15/authenticating-with-tfs-connect-and-tfs-dashboard/</guid>
      <description><![CDATA[In this blog post, I’ll discuss how to login to – TFS Connect and TFS Dashboard written for Windows...]]></description>
      <content:encoded><![CDATA[<p>In this blog post, I’ll discuss how to login to – TFS Connect and TFS Dashboard written for Windows Phone 8 and Windows 8 respectively. The instructions are the same for the both the apps. The apps can be downloaded from <a href="https://www.microsoft.com/en-us/download/details.aspx?id=36230">here</a>. The TFS Dashboard app is also available in the <a href="https://apps.microsoft.com/windows/en-US/app/tfsdashboard/aaf9b5ba-c22f-4ea6-a7bd-cc42108e9053">Windows store</a>.</p>  <p>When you run the TFS Dashboard app for the first time, a login page appears: </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/7571.image_060BA029.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/7571.image_5F00_060BA029.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/3362.image_thumb_7EEC63B0.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/3362.image_5F00_thumb_5F00_7EEC63B0.png" width="384" height="210" /></a></p>  <p>and similarly for the TFS Connect phone app:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/6813.image_45D586AE.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/6813.image_5F00_45D586AE.png"><img title="image" style="margin: 0px; display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/5327.image_thumb_77CD2738.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/5327.image_5F00_thumb_5F00_77CD2738.png" width="151" height="244" /></a></p>  <p>&#160;</p>  <h4>Team Foundation Service authentication:</h4>  <p>In order to authenticate with <a href="https://tfs.visualstudio.com">Team Foundation Service</a>, you will need to enable and configure basic auth credentials for your user profile on tfs.visualstudio.com:</p>  <ul>   <li>Navigate to the account that you want to use on <a href="https://tfs.visualstudio.com">https://tfs.visualstudio.com</a>. For example, you may have https://domain.visualstudio.com. </li>    <li>In the top-right corner, click on your account name and then select <strong>My Profile</strong></li> </ul>  <p>&#160;</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/7220.image_6CA39CEE.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/7220.image_5F00_6CA39CEE.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/6724.image_thumb_1E9B3D79.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/6724.image_5F00_thumb_5F00_1E9B3D79.png" width="244" height="154" /></a></p>  <ul>   <li>Select the <strong>Credentials</strong> tab </li>    <li>Click the '<strong>Enable alternate credentials and set password</strong>' link </li>    <li>Enter a password. It is suggested that you choose a unique password here (not associated with any other accounts) </li> </ul>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/4670.image_1371B32F.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/4670.image_5F00_1371B32F.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/7713.image_thumb_7356A671.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/7713.image_5F00_thumb_5F00_7356A671.png" width="272" height="227" /></a></p>  <ul>   <li>Click <strong>Save Changes</strong></li> </ul>  <p>&#160;</p>  <p>Next, run the sample app and on the Login page, for the <strong>Domain</strong> field, the domain is from <strong>domain</strong>.visualstudio.com, <strong>Username</strong> is from the Credentials tab under My Profile, and <strong>Password</strong> is the password that you just created. The <strong>Service Endpoint</strong> is <a href="https://tfsodata.visualstudio.com/DefaultCollection/">https://tfsodata.visualstudio.com/DefaultCollection/</a> .</p>  <h4>&#160;</h4>  <h4>Using an on-premises Team Foundation Server:</h4>  <p>You will need to first install and configure the <a href="https://aka.ms/tfsodata">OData Service for Team Foundation Server v2</a> to expose an OData endpoint for your Team Foundation Server instance. </p>  <p>For the <strong>Domain</strong> field, you would enter the workgroup or domain of your Team Foundation Server.</p>  <p><strong>Username</strong> will be the username you use to login to Team Foundation Server </p>  <p><strong>Password</strong> is the password you use to login to Team Foundation Server </p>  <p><strong>Service Endpoint</strong> is the OData Service endpoint address that you have used to host the OData Service. For example something similar to: </p>  <p>https://&lt;name of the server where OData service is hosted&gt;:&lt;portnumber&gt;/&lt;Defaultcollection or Name of Collection&gt;/</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/3771.image_254E46FC.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/3771.image_5F00_254E46FC.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/8535.image_thumb_372ADAC9.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/8535.image_5F00_thumb_5F00_372ADAC9.png" width="510" height="356" /></a></p>  <p>You can also try to connect to the OData service via IE to test out your credentials.</p>  <p>In the above screenshot, the address in the web browser is my OData Service endpoint i.e. <a href="https://localhost:10042/FabrikamFiberCollection/">https://localhost:10042/FabrikamFiberCollection/</a> . My credentials are the TFS credentials, so Domain is ‘vsalm’, Username is ‘admin’ and Password is the password used to login into Team Foundation Server.</p>  <p>By default, the OData Service is setup in a manner that a HTTP endpoint will throw an error. For testing purposes you can change this by setting ‘Transport’ to ‘None’ in web.config of ODataTFS.Web project:</p>  <p>&lt;security mode=&quot;None&quot;&gt;&lt;/security&gt;</p>  <p>If you are using a HTTPS endpoint make sure that the certificate is recognized as a valid certificate by the machine that is running the app. The certificate should be placed into the machine-wide Trusted Root Certification Authorities store. For information on configuring certificates on a machine, please go through the <a href="https://www.microsoft.com/en-us/download/details.aspx?id=36230">ReadMe</a> document of the OData Service. </p>  <p>After successfully logging in, your apps should resemble the following screens.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/3603.image_3DDDE44C.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/3603.image_5F00_3DDDE44C.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/6153.image_thumb_1DC2D78F.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/6153.image_5F00_thumb_5F00_1DC2D78F.png" width="464" height="277" /></a></p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/7416.AfterLoginPage_7DA7CAD1.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/7416.AfterLoginPage_5F00_7DA7CAD1.png"><img title="AfterLoginPage" style="display: inline; background-image: none;" border="0" alt="AfterLoginPage" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/6811.AfterLoginPage_thumb_0B7A10CD.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/6811.AfterLoginPage_5F00_thumb_5F00_0B7A10CD.png" width="148" height="244" />&#160;</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Updating Secondary Tiles using Background Task</title>
      <link>https://docs.microsoft.com/archive/blogs/nishasingh/updating-secondary-tiles-using-background-task</link>
      <pubDate>Wed, 16 Jan 2013 22:22:39 GMT</pubDate>
      <dc:creator><![CDATA[Nisha Singh]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/nishasingh/2013/01/16/updating-secondary-tiles-using-background-task/</guid>
      <description><![CDATA[In this blog post, I will be discussing how to update secondary tiles using background tasks in a...]]></description>
      <content:encoded><![CDATA[<ul></ul>  <p>In this blog post, I will be discussing how to update secondary tiles using background tasks in a Windows Store App. I’ll be using the example of <a href="https://www.microsoft.com/en-us/download/details.aspx?id=36230">TFS Dashboard App</a> in which I connect to <a href="https://www.microsoft.com/en-us/download/details.aspx?id=36230">OData Service for Team Foundation Server</a> to retrieve data from TFServer. The source code of this App is available for <a href="https://www.microsoft.com/en-us/download/details.aspx?id=36230">download</a>. Consider a scenario where you pin a <a href="https://msdn.microsoft.com/en-us/library/bb822075(VS.90).aspx">query</a> from your WorkItems to the Start screen and would like to see it update every 15 minutes with the latest result information even when the App is not running. </p>  <p>Let’s go through the steps of pinning a tile:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/5543.image_3ABDEBAC.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/5543.image_5F00_3ABDEBAC.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/6114.image_thumb_2854D950.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/6114.image_5F00_thumb_5F00_2854D950.png" width="504" height="285" /></a></p>  <p>The above screen shows a query ‘Product Backlog’ and the resulting WorkItems that fall under that query. I can swipe from the bottom of the screen and bring up the AppBar. </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/5756.image_685B430A.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/5756.image_5F00_685B430A.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/5488.image_thumb_24DF07DC.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/5488.image_5F00_thumb_5F00_24DF07DC.png" width="504" height="285" /></a></p>  <p>Then I can click on the ‘Pin to Start’ button to pin the query to the Start screen.</p>  <p>&#160;</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/6443.image_792AEB87.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/6443.image_5F00_792AEB87.png"><img title="image" style="margin: 0px; display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/7827.image_thumb_73039EEC.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/7827.image_5F00_thumb_5F00_73039EEC.png" width="244" height="101" /></a></p>  <p>The Start screen will then show my pinned query ‘Product Backlog’ as a tile which updates to show the latest count of WorkItems. Each of the pinned tiles will ping the OData Service and display the updated number of WorkItems, even when the App is not running.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/8836.image_3147152B.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/8836.image_5F00_3147152B.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/3323.image_thumb_3B3F548C.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/3323.image_5F00_thumb_5F00_3B3F548C.png" width="504" height="285" /></a></p>  <p>I can pin multiple tiles from the App and change their size on the Start screen to be smaller (square) or larger (wide). </p>  <p>To achieve this, we will follow these steps:</p>  <p><strong>Step 1:</strong> Create Pin and Unpin buttons as part of BottomAppBar for the tile on the xaml page where you want to be able to pin the items. In my case, I’ll add the buttons to the ItemDetailPage.xaml. You can add Page.BottomAppBar at the same level as Page.Resources section. </p>  <p style="background-color: rgb(244, 244, 244);">XAML</p>  <div style="background-color: rgb(244, 244, 244);">   <p>&lt;Page.BottomAppBar&gt;      <br />&#160;&#160;&#160;&#160;&#160;&#160; &lt; AppBar x:Name=&quot;PageAppBar&quot; Padding=&quot;10,0,10,0&quot;&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Grid&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt; StackPanel x:Name=&quot;LeftCommands&quot; Orientation=&quot;Horizontal&quot; HorizontalAlignment=&quot;Left&quot;&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Button x:Name=&quot;HomeButton&quot; HorizontalAlignment=&quot;Left&quot; Style=&quot;{StaticResource HomeAppBarButtonStyle}&quot;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Click=&quot;HomeButtonClicked&quot;/&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Button x:Name=&quot;PinTileButton&quot; HorizontalAlignment=&quot;Left&quot; Style=&quot;{StaticResource PinAppBarButtonStyle}&quot;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Click=&quot;OnPinTileButtonClicked&quot; Visibility=&quot;{Binding PinSecondaryTileButtonVisibility}&quot;/&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Button x:Name=&quot;UnpinTileButton&quot; HorizontalAlignment=&quot;Left&quot; Style=&quot;{StaticResource UnpinAppBarButtonStyle}&quot;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Click=&quot;UnpinTileButtonClicked&quot; Visibility=&quot;{Binding UnpinSecondaryTileButtonVisibility}&quot;/&gt;</p>    <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/StackPanel&gt;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/Grid&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160; &lt;/AppBar&gt;       <br />&#160;&#160; &lt;/Page.BottomAppBar&gt;</p> </div>  <p>&#160;&#160; </p>  <p>The OnPinTileButtonClicked and UnpinTileButtonClicked event handlers used in the buttons above can be defined in ItemDetailPage.xaml.cs:&#160; </p>  <p style="background-color: rgb(244, 244, 244);">C#</p>  <div style="background-color: rgb(244, 244, 244);">   <p>private async void OnPinTileButtonClicked(object sender, RoutedEventArgs e)      <br /> {       <br />&#160;&#160;&#160; this.BottomAppBar.IsSticky = true;       <br />&#160;&#160;&#160; this.BottomAppBar.IsOpen = true;</p>    <p>&#160;&#160;&#160; Query item = (Query)navigationParam;      <br />&#160;&#160;&#160; await BackgroundTaskHelper.CreateTile(item, (Visibility)this.DefaultViewModel[&quot;PinSecondaryTileButtonVisibility&quot;],       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; (Visibility)this.DefaultViewModel[&quot;UnpinSecondaryTileButtonVisibility&quot;]);</p>    <p>&#160;&#160;&#160; SetVisibility(item);      <br />&#160;&#160;&#160; this.BottomAppBar.IsOpen = false;       <br />&#160;&#160;&#160; this.BottomAppBar.IsSticky = false;</p>    <p>}      <br /></p> </div>  <div style="background-color: rgb(244, 244, 244);">   <p>private async void UnpinTileButtonClicked(object sender, RoutedEventArgs e)      <br /> {       <br />&#160;&#160;&#160; // Keep AppBar open until done.       <br />&#160;&#160;&#160; this.BottomAppBar.IsSticky = true;       <br />&#160;&#160;&#160; this.BottomAppBar.IsOpen = true;</p>    <p>&#160;&#160;&#160; Query item = (Query)navigationParam;      <br />&#160;&#160;&#160; await BackgroundTaskHelper.DeleteTile(item, sender, (Visibility)this.DefaultViewModel[&quot;PinSecondaryTileButtonVisibility&quot;],       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; (Visibility)this.DefaultViewModel[&quot;UnpinSecondaryTileButtonVisibility&quot;]);       <br />&#160;&#160;&#160; SetVisibility(item);       <br />&#160;&#160;&#160; this.BottomAppBar.IsOpen = false;       <br />&#160;&#160;&#160; this.BottomAppBar.IsSticky = false;       <br />&#160;&#160;&#160; </p>    <p>}</p> </div>  <p>For information on how to toggle between Pin and Unpin button in the bottom AppBar, please see the <a href="https://www.microsoft.com/en-us/download/details.aspx?id=36230">source code</a>.</p>  <p>&#160;</p>  <p><strong>Step 2:</strong> Create Secondary Tiles in your Windows Store App</p>  <p>I have created a class BackgroundTaskHelper where CreateTile and DeleteTile methods are defined. The CreateTile method is used to create a Secondary tile whenever OnPinTileButtonClicked event is called.</p>  <p style="background-color: rgb(244, 244, 244);">C#</p>  <div style="background-color: rgb(244, 244, 244);">   <p>public async static Task CreateTile(Query item, Visibility PinTileButton, Visibility UnpinTileButton)      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var squareLogo = new Uri(&quot;ms-appx:///Assets/TFSLogo150_150.png&quot;);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var wideLogo = new Uri(&quot;ms-appx:///Assets/TFSLogo310_150.png&quot;);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //checking if tile has already been pinned       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (!SecondaryTile.Exists(GetTileId(item.Title)))       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; SecondaryTile tile = new SecondaryTile(       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; GetTileId(item.Title),&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // Tile ID       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; item.Subtitle,&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // Tile short name       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; item.Subtitle,&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // Tile display name       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; item.UniqueId,&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // Activation argument       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; TileOptions.ShowNameOnLogo | TileOptions.ShowNameOnWideLogo, // Tile options       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; wideLogo&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // Tile logo URI       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; );</p>    <p>     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; tile.WideLogo = wideLogo;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; bool isPinned = await tile.RequestCreateAsync();</p>    <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (isPinned)      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; BackgroundTaskHelper.UpdateSecondaryTile(item, tile);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p> </div>  <h6>Note: SecondaryTile constructor requires a Tile ID that has a length not greater than 64. And Tile ID must begin with a number or letter and be composed of the characters a-z, A-Z, 0-9, period (.), or underscore (_). It cannot contain spaces, commas, or any of these characters: | &gt; &lt; &quot; / ? * \ ; : ! '&#160; </h6>  <p>Once the tile is pinned, we want the user to be able to unpin the tile from the UI. Whenever the user unpins a tile, we will call the UnpinTileButtonClicked event handler and consequently call the DeleteTile method that would delete the tile.</p>  <div style="background-color: rgb(244, 244, 244);">   <p>public async static Task DeleteTile(Query item, object sender, Visibility PinTileButton, Visibility UnpinTileButton)      <br /> {       <br />&#160;&#160;&#160; //checking if tile has already been pinned       <br />&#160;&#160;&#160; if (SecondaryTile.Exists(GetTileId(item.Title)))       <br />&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; SecondaryTile secondaryTile = new SecondaryTile(GetTileId(item.Title));       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; await secondaryTile.RequestDeleteForSelectionAsync(GetElementRect((FrameworkElement)sender), Windows.UI.Popups.Placement.Above);       <br />&#160;&#160;&#160; }       <br />} </p> </div>&#160;&#160;&#160;&#160; <p>After creating a Secondary tile, you may want to apply a tile template to it. Check out <a href="https://msdn.microsoft.com/en-us/library/windows/apps/hh761491.aspx">tile templates</a> for more information on it. This is how I update the Secondary tile after creating it:</p>  <div style="background-color: rgb(244, 244, 244);">   <p>public static async void UpdateSecondaryTile(Query item, SecondaryTile tile)      <br /> {       <br />&#160;&#160;&#160; if (SecondaryTile.Exists(tile.TileId))       <br />&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; TileUpdater tileUpdater = TileUpdateManager.CreateTileUpdaterForSecondaryTile(tile.TileId);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; XmlDocument tileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileSquareBlock);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; XmlDocument tileWideXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWideBlockAndText02);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; XmlElement visualElement = ((XmlElement)tileWideXml.GetElementsByTagName(&quot;visual&quot;)[0]);</p>    <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; //wide tile setting      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; XmlElement textElem = (XmlElement)tileWideXml.GetElementsByTagName(&quot;text&quot;)[0];       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; textElem.AppendChild(tileWideXml.CreateTextNode(tile.ShortName));       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; textElem = (XmlElement)tileWideXml.GetElementsByTagName(&quot;text&quot;)[1];       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; textElem.AppendChild(tileWideXml.CreateTextNode(item.ActualCount.ToString()));       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; textElem = (XmlElement)tileWideXml.GetElementsByTagName(&quot;text&quot;)[2];       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; textElem.AppendChild(tileWideXml.CreateTextNode(&quot;work items&quot;));       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; // square tile setting       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; XmlElement textElement = (XmlElement)tileXml.GetElementsByTagName(&quot;text&quot;)[0];       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; textElement.AppendChild(tileXml.CreateTextNode(item.ActualCount.ToString()));       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; textElement = (XmlElement)tileXml.GetElementsByTagName(&quot;text&quot;)[1];       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; textElement.AppendChild(tileXml.CreateTextNode(tile.ShortName));       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; IXmlNode node = tileWideXml.ImportNode(tileXml.GetElementsByTagName(&quot;binding&quot;).Item(0), true);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; visualElement.AppendChild(node);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; tileUpdater.Update(new TileNotification(tileWideXml));       <br />&#160;&#160;&#160; }       <br /> }       <br /></p> </div>  <p>This is how the tile looks in wide and square tile format:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/0083.image_5C6E88C1.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/0083.image_5F00_5C6E88C1.png"><img title="image" style="margin: 0px; display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/0160.image_thumb_66537A2C.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/0160.image_5F00_thumb_5F00_66537A2C.png" width="244" height="214" /></a></p>  <p>&#160;</p>  <p><strong>Step 3:</strong> Add a WindowsRuntimeComponent project in your solution to create a background task.</p>  <p>Go to your solution in Visual Studio, right click on the solution and click on Add-&gt;New Project,&#160; select ‘WindowsRuntimeComponent’ and rename the project. I have renamed it to ‘Testing’. And then hit the OK button.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/2630.image_7E76E487.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/2630.image_5F00_7E76E487.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/0068.image_thumb_50A91BC2.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/0068.image_5F00_thumb_5F00_50A91BC2.png" width="504" height="275" /></a></p>  <p>Edit the existing class ‘Class1.cs’ or include a new class file that implements the interface IBackgroundTask. In this sample, I have a TFSTasks class that implements the IBackgroundTask interface. This is how the Run method of the IBackgroundTask is implemented:</p>  <p>&#160;</p>  <div style="background-color: rgb(244, 244, 244);">   <p>&#160;&#160; //Main Run method which is activated every 15 minutes      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; public async void Run(IBackgroundTaskInstance taskInstance)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // Associate a cancellation handler with the background task.       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; taskInstance.Canceled += new BackgroundTaskCanceledEventHandler(OnCanceled);</p>    <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // Because these methods are async, you must use a deferral      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // to wait for all of them to complete       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; BackgroundTaskDeferral deferral = taskInstance.GetDeferral();       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ApplicationDataContainer roamingSettings = ApplicationData.Current.RoamingSettings;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //get the authorization details       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ApplicationDataCompositeValue composite =       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; (ApplicationDataCompositeValue)roamingSettings.Values[&quot;authorizationCompositeSetting&quot;];       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; IReadOnlyCollection&lt;SecondaryTile&gt; tiles = await SecondaryTile.FindAllForPackageAsync();       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (composite != null &amp;&amp; tiles != null)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; foreach(SecondaryTile tile in tiles)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; HttpWebRequest Request = (HttpWebRequest)WebRequest.Create(tile.Arguments + &quot;/WorkItems/$count&quot;);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Request.Method = &quot;GET&quot;;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Request.Headers[&quot;Authorization&quot;] = composite[&quot;authHeader&quot;].ToString();       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; try       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; HttpWebResponse Response = (HttpWebResponse)await Request.GetResponseAsync();       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (Response != null)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; StreamReader ResponseDataStream = new StreamReader(Response.GetResponseStream());       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; string response = ResponseDataStream.ReadToEnd();</p>    <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (SecondaryTile.Exists(tile.TileId))      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; TileUpdater tileUpdater = TileUpdateManager.CreateTileUpdaterForSecondaryTile(tile.TileId);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; XmlDocument tileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileSquareBlock);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; XmlDocument tileWideXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWideBlockAndText02);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; XmlElement visualElement = ((XmlElement)tileWideXml.GetElementsByTagName(&quot;visual&quot;)[0]);</p>    <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //wide tile setting       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; XmlElement textElem = (XmlElement)tileWideXml.GetElementsByTagName(&quot;text&quot;)[0];       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; textElem.AppendChild(tileWideXml.CreateTextNode(tile.ShortName));       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; textElem = (XmlElement)tileWideXml.GetElementsByTagName(&quot;text&quot;)[1];       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; textElem.AppendChild(tileWideXml.CreateTextNode(response));       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; textElem = (XmlElement)tileWideXml.GetElementsByTagName(&quot;text&quot;)[2];       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; textElem.AppendChild(tileWideXml.CreateTextNode(&quot;work items&quot;));       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // square tile setting       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; XmlElement textElement = (XmlElement)tileXml.GetElementsByTagName(&quot;text&quot;)[0];       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; textElement.AppendChild(tileXml.CreateTextNode(response));       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; textElement = (XmlElement)tileXml.GetElementsByTagName(&quot;text&quot;)[1];       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; textElement.AppendChild(tileXml.CreateTextNode(tile.ShortName));       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; IXmlNode node = tileWideXml.ImportNode(tileXml.GetElementsByTagName(&quot;binding&quot;).Item(0), true);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; visualElement.AppendChild(node);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; tileUpdater.Update(new TileNotification(tileWideXml));       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; catch (Exception ex)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Debug.WriteLine(ex.Message);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; deferral.Complete();       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p> </div>  <p>The Run method will be activated every 15 minutes. In this method, we look for authorization data in the roaming settings and find all the tiles that are currently pinned. For every tile that exists, we will send an HTTP request to the OData Service for TFS to return the count of WorkItems. For instance, a sample URL like this would return the count of WorkItems existing in a Query identified by GUID - '615dfb1f-e21f-4a8c-b45a-da396feb2c7b':</p>  <p><a title="https://odatapreview-dev.cloudapp.net/DefaultCollection/Queries(&#39;615dfb1f-e21f-4a8c-b45a-da396feb2c7b&#39;)/WorkItems/$count" href="https://localhost:44301/DefaultCollection/Queries('615dfb1f-e21f-4a8c-b45a-da396feb2c7b')/WorkItems/$count">https://localhost:44301/DefaultCollection/Queries('615dfb1f-e21f-4a8c-b45a-da396feb2c7b')/WorkItems/$count</a></p>  <p>Include the following using statements in the beginning of your class file.</p>  <div style="background-color: rgb(244, 244, 244);">   <p>using Windows.ApplicationModel.Background;      <br /> using Windows.Data.Xml.Dom;       <br /> using Windows.Storage;       <br /> using Windows.UI.Notifications;       <br /> using Windows.UI.StartScreen;</p> </div>  <p><strong></strong></p>  <p><strong>Step 4: </strong>Add the above WindowsRuntimeComponent to your WindowsStoreApp.</p>  <p> Right click on your App project and click on “Add Reference” and select ‘Testing’ project under the Projects section.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/2703.image_127FDB44.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/2703.image_5F00_127FDB44.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/0640.image_thumb_7D2225DB.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/0640.image_5F00_thumb_5F00_7D2225DB.png" width="244" height="116" /></a></p>  <p>Hit the OK button and the project reference is added to your project. Now double click on the Package.appxmanifest file in the SolutionExplorer and go to the Declarations tab.</p>  <p>Select Background Tasks from the list of ‘Available Declarations’ and hit the Add button.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/2318.image_3BA77382.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/2318.image_5F00_3BA77382.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/7485.image_thumb_5B564D4A.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/7485.image_5F00_thumb_5F00_5B564D4A.png" width="319" height="127" /></a></p>  <p>I have selected ‘System event’ in the ‘Supported task types’ property of the Declarations tab. And I have set the entry point as ‘Testing.TFSTasks’. Note that the entry point has to be entered in the form of ‘&lt;Namespace&gt;.&lt;Classname&gt;’.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/1207.image_619D23D8.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/1207.image_5F00_619D23D8.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/0045.image_thumb_535EAAE8.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/0045.image_5F00_thumb_5F00_535EAAE8.png" width="454" height="219" /></a></p>  <p><strong></strong></p>  <p><strong>Step 5:</strong> Register the background task in App.xaml.cs: </p>  <div style="background-color: rgb(244, 244, 244);">   <p>public static void CheckIfBackgroundTaskExist()     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (BackgroundTaskRegistration.AllTasks.Count &lt; 1)      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; RegisterBackgroundTask();       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>    <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Registering the maintenance trigger background task&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; public static void RegisterBackgroundTask()       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; BackgroundTaskBuilder builder = new BackgroundTaskBuilder();       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; builder.Name = &quot;SecondaryTileUpdate&quot;;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; builder.TaskEntryPoint = &quot;Testing.TFSTasks&quot;;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; IBackgroundTrigger trigger = new MaintenanceTrigger(15, false);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; builder.SetTrigger(trigger);</p>    <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; IBackgroundTaskRegistration task = builder.Register();      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p> </div>  <p>Before you register, call the CheckIfBackgroundTaskExist() method that checks if the background task is already registered. If your App has more than one background task registered, then you loop through all the tasks and look for the Name property in the value part of theBackgroundTaskRegistration.AllTasks key – value pair to check whether the task you are trying to register already exists. While registering the background task, I have to give a name to the BackgroundTask and provide an entry point. The maintenance trigger is set to 15 minutes. We are almost done here.</p>  <p>&#160;</p>  <p><strong>Step 6:</strong> Activating the App from the tile</p>  <p> If a user clicks on a certain tile on the Start screen, he would expect to be navigated to the related page in your App for that tile. To enable this, in the OnLaunched method of App.xaml.cs, add the following lines of code:</p>  <div style="background-color: rgb(244, 244, 244);">   <p>if (!String.IsNullOrEmpty(args.Arguments))      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ((Frame)Window.Current.Content).Navigate(typeof(ItemDetailPage), args.Arguments);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Window.Current.Activate();       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return;</p> </div>  <p>To summarize, we created and updated Secondary tiles then we wrote background tasks that will update the tiles after an interval of 15 minutes. We registered that background task in our Windows Store App and now we are ready to have fun with Live tiles!! </p>]]></content:encoded>
    </item>
    <item>
      <title>Sharing data from a Windows Store App using WinRT API</title>
      <link>https://docs.microsoft.com/archive/blogs/nishasingh/sharing-data-from-a-windows-store-app-using-winrt-api</link>
      <pubDate>Wed, 16 Jan 2013 12:18:58 GMT</pubDate>
      <dc:creator><![CDATA[Nisha Singh]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/nishasingh/2013/01/16/sharing-data-from-a-windows-store-app-using-winrt-api/</guid>
      <description><![CDATA[&#160;  In this blog post, I’ll go through the steps of implementing the Share feature in your...]]></description>
      <content:encoded><![CDATA[<p>&#160;</p>  <p>In this blog post, I’ll go through the steps of implementing the <a href="https://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.datatransfer.aspx">Share feature</a> in your Windows Store App. Sharing data can be bidirectional, your App can either accept data from another App and/or your App can share data to another App. In this article, I’ll discuss the latter scenario in which you share data with another App and your App acts as a source of information for sharing. I’ll be using the example of <a href="https://www.microsoft.com/en-us/download/details.aspx?id=36230">TFS Dashboard App</a> in which I connect to <a href="https://www.microsoft.com/en-us/download/details.aspx?id=36230">OData Service for Team Foundation Server</a> to retrieve data from TFServer. The source code of this App is available for <a href="https://www.microsoft.com/en-us/download/details.aspx?id=36230">download</a>.</p>  <p>Consider a scenario where you want to share WorkItems from a Windows Store App with a team member. In this App, you can select the WorkItems that you wish to share.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/6740.image_2EA9D7D4.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/6740.image_5F00_2EA9D7D4.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/6763.image_thumb_47397524.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/6763.image_5F00_thumb_5F00_47397524.png" width="504" height="275" /></a></p>  <p>&#160;</p>  <p>And bring up the Charms bar (Windows key + C or swipe from the right) and hit the Share button. </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/8004.image_122CE5F4.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/8004.image_5F00_122CE5F4.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/0574.image_thumb_2DD171EA.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/0574.image_5F00_thumb_5F00_2DD171EA.png" width="504" height="275" /></a></p>  <p>Then from a list of Apps that accept the data format that you are sharing will be available as share targets. </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/4377.image_78C4E2B9.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/4377.image_5F00_78C4E2B9.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/4300.image_thumb_667C1BF7.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/4300.image_5F00_thumb_5F00_667C1BF7.png" width="504" height="281" /></a></p>  <p>For this example, let’s select the Mail App, and send the WorkItems to my colleague:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/2046.image_5F5CDF7F.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/2046.image_5F00_5F5CDF7F.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/2630.image_thumb_4D1418BD.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/2630.image_5F00_thumb_5F00_4D1418BD.png" width="504" height="297" />&#160;</a></p>  <p>Now let’s implement share in our Windows Store App. </p>  <p>&#160;</p>  <p><strong>Step 1:</strong> Add the event “OnDataRequested” towards the end of the LoadState() method of the ItemDetailPage.xaml.cs or the page you want to share the data from.</p>  <div style="background-color: rgb(244, 244, 244);">   <p>DataTransferManager.GetForCurrentView().DataRequested += OnDataRequested;</p> </div>  <p>DataRequested event is part of Windows.ApplicationModel.DataTransfer namespace. Hence add the following using statement on the page.</p>  <div style="background-color: rgb(244, 244, 244);">   <p>using Windows.ApplicationModel.DataTransfer;</p> </div>  <p>and for StringBuilder class add the namespace:</p>  <div style="background-color: rgb(244, 244, 244);">   <p>using System.Text;</p> </div>  <p>&#160;</p>  <p><strong>Step2:</strong> When we bring up the Charms bar and hit the Share button then the OnDataRequested event is called for that App.</p>  <p>We need to handle the OnDataRequested event. Add this event handler to your page, in my case it is ItemDetailPage.xaml.cs.</p>  <p style="background-color: rgb(244, 244, 244);">C#</p>  <div style="background-color: rgb(244, 244, 244);">   <p>void OnDataRequested(DataTransferManager sender, DataRequestedEventArgs args)      <br /> {       <br />&#160;&#160;&#160; var request = args.Request;       <br />&#160;&#160;&#160; StringBuilder html = new StringBuilder();       <br />&#160;&#160;&#160; if (this.itemGridView.SelectedItems.Count != 0)       <br />&#160;&#160;&#160; {</p>    <p>&#160;&#160;&#160;&#160;&#160;&#160; //if the selected items count is greater than 1 then create an html ordered list – numbered list      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (this.itemGridView.SelectedItems.Count &gt; 1)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var items = this.itemGridView.SelectedItems;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; html.Append(&quot;&lt;ol&gt;&quot;);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; foreach(WorkItem item in items)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; html.Append(&quot;&lt;li&gt;&lt;h4&gt;&quot; + item.Title + &quot;&lt;/h4&gt;&quot;);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; html.Append(&quot;Created by:&quot; + item.CreatedBy + &quot;&lt;br/&gt;&quot;);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; html.Append(&quot;Assigned To:&quot; + item.AssignedTo + &quot;&lt;br/&gt;&quot;);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; html.Append(&quot;State:&quot; + item.State + &quot;&lt;br/&gt;&quot;);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; html.Append(&quot;Type:&quot; + item.Type + &quot;&lt;br/&gt;&quot;);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; html.Append(&quot;&lt;a href=\&quot;&quot; + item.WebEditorUrl + &quot;\&quot;&gt;Visit Workitem in TFS&lt;/a&gt;&lt;br/&gt;&lt;/li&gt;&quot;);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; html.Append(&quot;&lt;/ol&gt;&quot;);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; else       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var item = (WorkItem)this.itemGridView.SelectedItem;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; html.Append(&quot;&lt;h4&gt;&quot; + item.Title + &quot;&lt;/h4&gt;&quot;);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; html.Append(&quot;Created by:&quot; + item.CreatedBy + &quot;&lt;br/&gt;&quot;);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; html.Append(&quot;Assigned To:&quot; + item.AssignedTo + &quot;&lt;br/&gt;&quot;);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; html.Append(&quot;State:&quot; + item.State + &quot;&lt;br/&gt;&quot;);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; html.Append(&quot;Type:&quot; + item.Type + &quot;&lt;br/&gt;&quot;);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; html.Append(&quot;&lt;a href=\&quot;&quot; + item.WebEditorUrl + &quot;\&quot;&gt;Visit Workitem in TFS&lt;/a&gt;&lt;br/&gt;&quot;);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; string data = Windows.ApplicationModel.DataTransfer.HtmlFormatHelper.CreateHtmlFormat(html.ToString());       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; request.Data.SetHtmlFormat(data);       <br />&#160;&#160;&#160; }       <br />&#160;&#160;&#160; request.Data.Properties.Title = &quot;Workitem/s from project &quot; + SampleDataSource.ProjectName;       <br />&#160;&#160;&#160; request.Data.Properties.Description = &quot;Checkout the workitem/s!!&quot;;       <br /> }       <br /></p> </div>  <p>In the above method, I go through the items that are selected i.e. WorkItems on the ItemDetailPage.xaml.cs page. I am selecting certain properties of the selected WorkItems and creating an HTML formatted text for sharing data. CreateHtmlFormat() is a method that checks your formatting and adds necessary headers. </p>  <p><strong>Step 3</strong>: Detach the event handler in the SaveState method</p>  <div style="background-color: rgb(244, 244, 244);">   <p>// Deregister the DataRequested event handler</p>    <p>DataTransferManager.GetForCurrentView().DataRequested -= OnDataRequested;</p> </div>  <p>&#160;</p>  <p>That’s it, we are done and ready to share data from our App.</p>  <p>For another sample example of implementing share by using Windows Store App as source of data visit: <a href="https://aka.ms/ShareAsSource">https://aka.ms/ShareAsSource</a>. </p>  <p>For Share API reference, visit: <a href="https://aka.ms/DataTransfer_API">https://aka.ms/DataTransfer_API</a>.</p>]]></content:encoded>
    </item>
    <item>
      <title>Integrating Search with OData Service for Team Foundation Server in a Windows Store App</title>
      <link>https://docs.microsoft.com/archive/blogs/nishasingh/integrating-search-with-odata-service-for-team-foundation-server-in-a-windows-store-app</link>
      <pubDate>Tue, 15 Jan 2013 00:09:17 GMT</pubDate>
      <dc:creator><![CDATA[Nisha Singh]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/nishasingh/2013/01/15/integrating-search-with-odata-service-for-team-foundation-server-in-a-windows-store-app/</guid>
      <description><![CDATA[&#160;  In this blog post, I will be discussing how to communicate with OData Service For TFS using...]]></description>
      <content:encoded><![CDATA[<p>&#160;</p>  <p>In this blog post, I will be discussing how to communicate with <a href="https://www.microsoft.com/en-us/download/details.aspx?id=36230">OData Service For TFS</a> using Search contracts in a Windows Store App. The source code for my sample App is available for <a href="https://www.microsoft.com/en-us/download/details.aspx?id=36230">download</a> as “TFSDashboardBeta.exe”. </p>  <p>In this sample App, I can search for a WorkItem across all the projects in TFS by entering the corresponding search term in the search box.</p>  <p>For example, if I enter “bug” in the search box, it will query the OData Service to look for WorkItems across all the projects that have the term “bug” matching with the State or Type property of a WorkItem. </p>  <p>This is what the search results look like when I search for the term “bug” against my <a href="https://msdn.microsoft.com/en-us/library/dd236915.aspx">project collection</a> in TFS:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/8321.image_2FF77DC9.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/8321.image_5F00_2FF77DC9.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/2553.image_thumb_1EC3A026.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/2553.image_5F00_thumb_5F00_1EC3A026.png" width="545" height="324" /></a></p>  <p>Clicking on a project title RadioButton will filter the search results to only show the WorkItems under that project. You can also see the count of search results under each of the projects represented by a number next to the project name. </p>  <p>Now I’ll go through the steps to achieve the above search results page.</p>  <p><strong>Step 1</strong>: To add the Search Contract, right click on your project and go to “Add-&gt;New Item”. You will see the following dialog:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/8311.image_165FCACF.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/8311.image_5F00_165FCACF.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/8308.image_thumb_66750340.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/8308.image_5F00_thumb_5F00_66750340.png" width="510" height="284" /></a></p>  <p>Look for “Search Contract” and rename it to “SearchResultsPage.xaml” and hit the ‘Add’ button. You will notice that two files are added to your project:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/3034.image_29FC8E96.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/3034.image_5F00_29FC8E96.png"><img title="image" style="margin: 0px; display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/0385.image_thumb_695A4226.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/0385.image_5F00_thumb_5F00_695A4226.png" width="244" height="46" /></a></p>  <p>&#160;</p>  <p><strong>Step 2</strong>: The files that were added have the default search results DataTemplate. I want my search results to show names of the WorkItems and the creator of that WorkItem. </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/4188.image_292428AC.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/4188.image_5F00_292428AC.png"><img title="image" style="margin: 0px; display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/7725.image_thumb_68EE0F31.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/7725.image_5F00_thumb_5F00_68EE0F31.png" width="244" height="67" /></a></p>  <p>To achieve this, I’ll make changes to the SearchResultsPage.xaml page. Remove the predefined ItemTemplates from</p>  <p>GridView :&#160; </p>  <div style="background-color: rgb(244, 244, 244);">   <p>ItemTemplate=&quot;{StaticResource StandardSmallIcon300x70ItemTemplate}&quot; </p> </div>  <p>and ListView:</p>  <div style="background-color: rgb(244, 244, 244);">   <p>ItemTemplate=&quot;{StaticResource StandardSmallIcon70ItemTemplate}&quot;</p> </div>  <p>&#160;</p>  <p>And add the templates for the GridView and the ListView:</p>  <p style="background-color: rgb(244, 244, 244);">XAML</p>  <div style="background-color: rgb(244, 244, 244);">   <p>&lt;GridView.ItemTemplate&gt;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt; DataTemplate&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Grid HorizontalAlignment=&quot;Left&quot; Width=&quot;294&quot; Height=&quot;70&quot; Background=&quot;#FF69B3E6&quot;&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt; StackPanel Orientation=&quot;Vertical&quot;&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt; TextBlock Style=&quot;{StaticResource SearchTitleTextStyle}&quot; Text=&quot;{Binding Title}&quot; ToolTipService.ToolTip=&quot;{Binding Title}&quot;/&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt; TextBlock Style=&quot;{StaticResource SearchDescriptionTextStyle}&quot; Visibility=&quot;{Binding CreatedBy, Converter={StaticResource NullOrEmptyToVisibilityConverter}}&quot;&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Run Text =&quot;Created by: &quot;&gt;&lt;/Run&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Run Text=&quot;{Binding CreatedBy}&quot;&gt;&lt;/Run&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/TextBlock&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/StackPanel&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/Grid&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/DataTemplate&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/GridView.ItemTemplate&gt;</p> </div>  <div style="background-color: rgb(244, 244, 244);">   <p>&lt;ListView.ItemTemplate&gt;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt; DataTemplate&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Grid HorizontalAlignment=&quot;Left&quot; Width=&quot;200&quot; Height=&quot;70&quot; Margin=&quot;6&quot; Background=&quot;#FF69B3E6&quot;&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt; StackPanel Orientation=&quot;Vertical&quot;&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt; TextBlock Style=&quot;{StaticResource SearchTitleTextStyle}&quot; Text=&quot;{Binding Title}&quot; ToolTipService.ToolTip=&quot;{Binding Title}&quot;/&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt; TextBlock Style=&quot;{StaticResource SearchDescriptionTextStyle}&quot; Visibility=&quot;{Binding CreatedBy, Converter={StaticResource NullOrEmptyToVisibilityConverter}}&quot;&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Run Text =&quot;Created by: &quot;&gt;&lt;/Run&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Run Text=&quot;{Binding CreatedBy}&quot;&gt;&lt;/Run&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/TextBlock&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/StackPanel&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/Grid&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/DataTemplate&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/ListView.ItemTemplate&gt;</p> </div>  <p>I have defined the styles used in the above code in the &lt;Page.Resources&gt; section of the SearchResultsPage.xaml:</p>  <div style="background-color: rgb(244, 244, 244);">   <p>&lt;Style x:Key=&quot;SearchTitleTextStyle&quot; TargetType=&quot;TextBlock&quot; BasedOn=&quot;{StaticResource ItemGridTitleTextStyle}&quot;&gt;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Setter Property=&quot;Margin&quot; Value=&quot;6,5,0,0&quot;&gt;&lt;/Setter&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Setter Property=&quot;FontSize&quot; Value=&quot;18&quot;&gt;&lt;/Setter&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/Style&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Style x:Key=&quot;SearchDescriptionTextStyle&quot; TargetType=&quot;TextBlock&quot; BasedOn=&quot;{StaticResource ItemGridDescriptionTextStyle}&quot;&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Setter Property=&quot;Margin&quot; Value=&quot;6,-5,0,0&quot;&gt;&lt;/Setter&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Setter Property=&quot;FontSize&quot; Value=&quot;14.5&quot;&gt;&lt;/Setter&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/Style&gt;</p> </div>  <p>Your styles and templates might differ depending upon how you want the search result items to appear. </p>  <p>&#160;</p>  <p><strong>Step 3</strong>: Rename the “App Name” in the string on the SearchResultsPage.xaml: </p>  <div style="background-color: rgb(244, 244, 244);">   <p>&lt;x:String x:Key=&quot;AppName&quot;&gt;App Name&lt;/x:String&gt;</p> </div>  <p> In my sample&#160; code, I have removed this line because it is defined already in the App.xaml file as </p>  <div style="background-color: rgb(244, 244, 244);">   <p>&lt;x:String x:Key=&quot;AppName&quot;&gt;TFS Dashboard&lt;/x:String&gt;</p> </div>  <p>&#160;</p>  <p><strong>Step 4</strong>: Now, I have my search results’ template ready. Next, I want to work on retrieving the search results from the OData Service for TFS. </p>  <p>If my OData Service endpoint looks like this:</p>  <p><a title="https://localhost:10042/DefaultCollection/" href="https://localhost:10042/DefaultCollection/">https://localhost:10042/DefaultCollection/</a>&#160;</p>  <p>then I can search for the term “bug&quot; in Type and State by constructing a query such as:</p>  <p>https://localhost:10042/DefaultCollection/WorkItems?$filter=substringof('bug',%20Type)%20eq%20true or substringof('bug',%20State)%20eq%20true</p>  <p>To achieve this, update the SearchResultsPage.xaml.cs file and replace the contents of the LoadState method to query the OData Service for results: </p>  <p style="background-color: rgb(244, 244, 244);">C#</p>  <div style="background-color: rgb(244, 244, 244);">   <p>var queryText = navigationParameter as String;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var filterList = new List&lt;Filter&gt;();</p>    <p>if (queryText != string.Empty)      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; filterList.Add(new Filter(&quot;All&quot;, 0, true));</p>    <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; string query = queryText.ToLower();      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; String urlToQuery = &quot;/WorkItems?$filter=substringof('&quot;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; + query + &quot;',%20Type)%20eq%20true or substringof('&quot; + query + &quot;',%20State)%20eq%20true&quot;;</p>    <blockquote>     <p>&#160; //get the OData feeds for the search query</p>   </blockquote>    <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; await SampleDataSource.GetFeed(AuthorizationHelper.authorizationHeader, AuthorizationHelper.endpoint, urlToQuery);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; String description = &quot;Search results for user entered query&quot;;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Query queryItem = new Query(&quot;SearchQuery&quot;, description, DateTime.Now, description, description);&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //parse the OData feeds to create WorkItem objects</p>    <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; await SampleDataSource.GetWorkitems(queryItem);</p>    <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var all = new List&lt;WorkItem&gt;();      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; all = queryItem.Items.ToList();       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; _results.Add(&quot;All&quot;, all);</p>    <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; for (int i = 0; i &lt; SampleDataSource.Projects.Count; i++)      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var matches = queryItem.Items.Where(item =&gt; item.Project.Equals(SampleDataSource.Projects[i]));       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (matches.Count() &gt; 0)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; filterList.Add(new Filter(SampleDataSource.Projects[i], matches.Count(), false));       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; _results.Add(SampleDataSource.Projects[i], matches.ToList());       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>    <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; filterList[0].Count = all.Count;</p>    <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // Communicate results through the view model      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.DefaultViewModel[&quot;ResultText&quot;] = &quot;Results for &quot; + '\u201c' + queryText + '\u201d';       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // Communicate results through the view model       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.DefaultViewModel[&quot;ResultText&quot;] = &quot;Enter a search term&quot;;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>    <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.DefaultViewModel[&quot;Filters&quot;] = filterList;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.DefaultViewModel[&quot;ShowFilters&quot;] = filterList.Count &gt; 1;</p> </div>  <p>&#160;</p>  <p>The “for loop” above goes through all the projects the WorkItems belong to and then binds filterList to the RadioButton for project selection and _results to GridView/ListView for displaying the results. </p>  <p>Include this list of results in the class SearchResultsPage.xaml.cs, before the constructor:</p>  <p style="background-color: rgb(244, 244, 244);">C#</p>  <div style="background-color: rgb(244, 244, 244);">   <p>private Dictionary&lt;string, List&lt;WorkItem&gt;&gt; _results = new Dictionary&lt;string, List&lt;WorkItem&gt;&gt;();</p> </div>  <p>&#160;</p>  <p>The GetFeed method called in the LoadState method above and defined in the SampleDataSource.cs file retrieves the OData feed for the search query:</p>  <p style="background-color: rgb(244, 244, 244);">C#</p>  <div style="background-color: rgb(244, 244, 244);">   <p>public static async Task GetFeed(string authHeader, string endpoint, string varQuery)      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; SyndicationClient client = new SyndicationClient();       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; client.BypassCacheOnRetrieve = true;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; client.SetRequestHeader(&quot;Authorization&quot;, authHeader);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Uri uri = null;</p>    <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; try      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (varQuery != null)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; uri = new Uri(string.Format(CultureInfo.InvariantCulture, &quot;{0}/{1}&quot;, endpoint, varQuery));       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; uri = new Uri(endpoint);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>    <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; currentFeed = await client.RetrieveFeedAsync(uri);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; catch (Exception ex)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //assign the query that failed       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; failedQuery = uri.ToString();       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; throw ex;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p> </div>  <p>For more information on the specific functions and properties mentioned in the above code, please <a href="https://www.microsoft.com/en-us/download/details.aspx?id=36230">download</a> the source code.</p>  <p>&#160;</p>  <p><strong>Step 5</strong>: If the user selects a different project by clicking on its RadioButton, we need to appropriately update the UI to reflect the search results for the selected project. To achieve this, go to Filter_SelectionChanged method in the SearchResultsPage.xaml.cs page and add this line of code, right after “//TODO” statement:</p>  <p style="background-color: rgb(244, 244, 244);">C#</p>  <div style="background-color: rgb(244, 244, 244);">   <p>this.DefaultViewModel[&quot;Results&quot;] = _results[selectedFilter.Name];</p> </div>  <p>&#160;</p>  <p><strong>Step 6</strong>: We can also add hint text in the App search box to guide the user. For instance, in the below screenshot, “Search on State or WorkItemType” act as a hint text. </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/2538.image_61CED2B9.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/2538.image_5F00_61CED2B9.png"><img title="image" style="margin: 0px; display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/7331.image_thumb_2198B93F.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/7331.image_5F00_thumb_5F00_2198B93F.png" width="244" height="111" /></a></p>  <p>To enable the hint text, we can set the PlaceholderText for the SearchPane in the OnLaunched() event in App.xaml.cs:</p>  <p style="background-color: rgb(244, 244, 244);">C#</p>  <div style="background-color: rgb(244, 244, 244);">   <p>SearchPane.GetForCurrentView().PlaceholderText = &quot;Search on State/WorkItemType&quot;;</p> </div>  <p>&#160;</p>  <p>In this sample App, I have also added support for external launching of the App via the Search Pane. You can find more information on it in the <a href="https://aka.ms/Win8Labs">hands on labs</a> and my source code that is available for <a href="https://www.microsoft.com/en-us/download/details.aspx?id=36230">download</a>.</p>  <p>For more information on Search contracts, I have recorded a video on <a href="https://channel9.msdn.com/Events/WOWZAPP/WOWZAPP-2012/Search-Integrating-Search-in-Windows-8-Apps">Channel9</a>. </p>]]></content:encoded>
    </item>
    <item>
      <title>TFS Dashboard – A sample Windows 8 Store App for Team Foundation Server</title>
      <link>https://docs.microsoft.com/archive/blogs/nishasingh/tfs-dashboard-a-sample-windows-8-store-app-for-team-foundation-server</link>
      <pubDate>Mon, 07 Jan 2013 16:08:12 GMT</pubDate>
      <dc:creator><![CDATA[Nisha Singh]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/nishasingh/2013/01/07/tfs-dashboard-a-sample-windows-8-store-app-for-team-foundation-server/</guid>
      <description><![CDATA[Update: OData access for Team Foundation Service&#160;is now available. You can read more about it...]]></description>
      <content:encoded><![CDATA[<p><font color="#a5b592"><font color="#808040">Update:</font> </font><a href="https://tfsodata.visualstudio.com/">OData access for Team Foundation Service</a>&#160;<font color="#808040">is now available. You can read more about it </font><a href="https://blogs.msdn.com/b/briankel/archive/2013/01/24/bringing-odata-to-team-foundation-service.aspx">here</a>. <font color="#808040">We have made some minor modifications to the Windows Store App and it is available in the <a href="https://apps.microsoft.com/windows/en-US/app/tfsdashboard/aaf9b5ba-c22f-4ea6-a7bd-cc42108e9053">Windows Store</a>. The source code and the Appx package is also available for </font><a href="https://www.microsoft.com/en-us/download/details.aspx?id=36230">download</a>. </p>  <p>Today we are releasing the beta of the OData Service for Team Foundation Server v2. In conjunction with that release I have been working on a sample Windows 8 Store App that connects to Team Foundation Server. I am glad to announce that the App - TFSDashboard - is now available for <a href="https://www.microsoft.com/en-us/download/details.aspx?id=36230">download</a>. To download the Appx package and source code for the App, download and run ‘TFSDashboardBeta.exe’. To setup the OData Service, download ‘ODataForTFS.V2.Beta.exe’. To connect to the OData Service via the App please go through respective ReadMe files included within each self-extracting installer package. </p>  <p>The TFS Dashboard App currently implements the <a href="https://msdn.microsoft.com/en-us/library/windows/apps/hh465372.aspx">Live tiles</a>, <a href="https://msdn.microsoft.com/library/windows/apps/BR225108">Search</a> and <a href="https://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.datatransfer.aspx">Share</a> features supported by the WinRT APIs. This App is primarily built to get users thinking towards building great Windows Store Apps, and to provide as an example for how to consume the OData Service for Team Foundation Server. </p>  <p>In consecutive blog posts, I’ll be getting into more details around consuming OData feeds for building functionalities such as <a href="https://msdn.microsoft.com/en-us/library/windows/apps/hh465372.aspx">Live tiles</a>, <a href="https://msdn.microsoft.com/library/windows/apps/BR225108">Search</a> and <a href="https://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.datatransfer.aspx">Share</a>.</p>  <p>Here are some screenshots of the App:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/2843.image_1E4F3487.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/2843.image_5F00_1E4F3487.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/7462.image_thumb_302BC854.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/7462.image_5F00_thumb_5F00_302BC854.png" width="370" height="238" /></a><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/2262.image_3DFE0E4F.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/2262.image_5F00_3DFE0E4F.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/1780.image_thumb_645FF19A.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/1780.image_5F00_thumb_5F00_645FF19A.png" width="371" height="236" /></a></p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/4426.image_2429D820.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/4426.image_5F00_2429D820.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/6153.image_thumb_36066BED.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/6153.image_5F00_thumb_5F00_36066BED.png" width="376" height="229" /></a><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/0020.image_5CD4822D.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/0020.image_5F00_5CD4822D.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/1108.image_thumb_6EB115FA.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/1108.image_5F00_thumb_5F00_6EB115FA.png" width="371" height="224" /></a></p>  <p>Have fun playing with it!! If you have any feedback or suggestions, please email <a href="mailto:TFSOData@Microsoft.com">us</a>.</p>  <p><a id="privacy"><font color="#333333">Privacy policy</font></a>: This App takes as input your TFS credential that is used for making authenticated calls to the OData Service. The App does not share the credential with any other website or App. The credential is encrypted while sending it to the OData Service.</p>]]></content:encoded>
    </item>
    <item>
      <title>Creating and deploying a WCF service on Windows Azure and consuming it in Windows 8 Store App</title>
      <link>https://docs.microsoft.com/archive/blogs/nishasingh/creating-and-deploying-a-wcf-service-on-windows-azure-and-consuming-it-in-windows-8-store-app</link>
      <pubDate>Tue, 04 Dec 2012 21:39:44 GMT</pubDate>
      <dc:creator><![CDATA[Nisha Singh]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/nishasingh/2012/12/04/creating-and-deploying-a-wcf-service-on-windows-azure-and-consuming-it-in-windows-8-store-app/</guid>
      <description><![CDATA[&#160;  &#160;  In this blog post, I will go through the steps involved in the creation of a WCF...]]></description>
      <content:encoded><![CDATA[<p>&#160;</p>  <p>&#160;</p>  <p>In this blog post, I will go through the steps involved in the creation of a WCF service that generates random numbers. I would also be deploying the service to Windows Azure. I will then discuss the process of creating a Windows 8 Store App that uses this WCF service. This blog post assumes you have created a Windows Azure account. You haven’t please see more information on account creation on their <a href="https://www.windowsazure.com/en-us/">website</a>. You also need to install Windows Azure SDK for Windows. You can install it from <a href="https://www.windowsazure.com/en-us/develop/downloads/">here</a>.</p>  <h5>Step 1: Create a WCF service</h5>  <p>Open Visual Studio 2012, and go to File-&gt;New-&gt;Project-&gt;Under Cloud, select Windows Azure Cloud Service. Rename the project to “RandomNumbers” or a name of your preference. </p>  <p>&#160;</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/2744.image_2B37396A.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/2744.image_5F00_2B37396A.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/0216.image_thumb_4BAE534F.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/0216.image_5F00_thumb_5F00_4BAE534F.png" width="560" height="337" /></a></p>  <p>Right after you create the project, another screen pops up as shown below. Select “WCF Service Web Role” under C# from the list of options and hit the “&gt;” button.</p>  <p>&#160;</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/5086.image_6F8704DC.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/5086.image_5F00_6F8704DC.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/7446.image_thumb_50ED1433.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/7446.image_5F00_thumb_5F00_50ED1433.png" width="555" height="364" /></a></p>  <p>This is how my project looks in the solution explorer after I hit the “OK” button in the above screen.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/7853.image_26DCF03E.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/7853.image_5F00_26DCF03E.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/2656.image_thumb_1EE54DDC.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/2656.image_5F00_thumb_5F00_1EE54DDC.png" width="282" height="289" /></a></p>  <p>I will rename my Service1 class and IService1 interface to RandomNumbers and IRandomNumbers throughout the project using “Rename” command in the Refactor menu. I will the rename the respective files too. The renaming is just for convenience of referring them back in this article. You can name them differently if you want.</p>  <p>Now, it’s time to create a simple function that generates random numbers between 1 and 100.</p>  <p>I will replace the functions in the RandomNumber.svc.cs&#160; with the following function:</p>  <p style="background-color: rgb(244, 244, 244);">C#</p>  <div style="background-color: rgb(244, 244, 244);">   <p>public string GetNumber()      <br />{       <br />&#160;&#160;&#160; Random number = new Random();       <br />&#160;&#160;&#160; return number.Next(1, 100).ToString();       <br />}       <br /></p> </div>  <p>Go to the IRandomNumbers interface and replace the operation contracts by this one:</p>  <p style="background-color: rgb(244, 244, 244);">C#</p>  <p style="background-color: rgb(244, 244, 244);">[OperationContract]    <br />string GetNumber();</p>  <p>The interface or service contract defines the methods that will be exposed when the WCF service is deployed.</p>  <p>Now you can build your solution and create packages to upload to Azure.</p>  <p>Right click on the ‘RandomNumbers’ project and click on the ‘Packages’ option. A dialog similar to below will pop up:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/0118.image_5506C62B.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/0118.image_5F00_5506C62B.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/0513.image_thumb_131FE0DD.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/0513.image_5F00_thumb_5F00_131FE0DD.png" width="519" height="291" /></a></p>  <p>To create packages to be deployed to Azure, hit the ‘Package’ button in the dialog as shown above. It creates two files in the ‘&lt;YourProjectName&gt;\bin\Release\app.publish’ folder. </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/6404.image_7D758272.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/6404.image_5F00_7D758272.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/5808.image_thumb_2F00F008.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/5808.image_5F00_thumb_5F00_2F00F008.png" width="259" height="154" /></a></p>  <p>&#160;</p>  <h4>Step 2: Deploy the service on Windows Azure</h4>  <p>Go to Windows Azure <a href="https://www.windowsazure.com/en-us/">website</a> and click on the ‘Portal’ link on the top right corner. Or go to: <a title="https://manage.windowsazure.com/#Workspace/All/dashboard" href="https://manage.windowsazure.com/#Workspace/All/dashboard">https://manage.windowsazure.com/#Workspace/All/dashboard</a> . I am assuming that you have a Windows Azure account if not please read more on account creation on the their <a href="https://www.windowsazure.com/en-us/">website</a>. Once you are in the portal, click on the ‘New’ button on the bottom right corner. A dialog similar to below will pop up:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/6406.image_46B8276E.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/6406.image_5F00_46B8276E.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/0624.image_thumb_3EE00EFF.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/0624.image_5F00_thumb_5F00_3EE00EFF.png" width="543" height="240" /></a></p>  <p>Select ‘Cloud Service’ from the screen and then ‘Quick Create’ option. In the below screen, you may enter ‘randomnumbers’ in the URL field. If the term is already in use then you have to provide a different one. Click on ‘Create Cloud Service’ to proceed further.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/2275.image_60E86AC5.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/2275.image_5F00_60E86AC5.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/3264.image_thumb_54E67A91.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/3264.image_5F00_thumb_5F00_54E67A91.png" width="550" height="303" /></a></p>  <p>A row appears in the ‘cloud services’ section that displays that the service was created. But it is not up and running as yet since we haven’t pushed any code to production or staging environment.</p>  <p>&#160;</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/3362.image_6D09E4EC.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/3362.image_5F00_6D09E4EC.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/8463.image_thumb_12FF9543.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/8463.image_5F00_thumb_5F00_12FF9543.png" width="551" height="40" /></a></p>  <p>When I click on the ‘randomnumbers’ cell, it displays a dashboard. I will click on the ‘Upload a new production deployment’ link to upload my code to production.</p>  <p>&#160;</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/8561.image_1293624E.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/8561.image_5F00_1293624E.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/8154.image_thumb_1D50B9A3.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/8154.image_5F00_thumb_5F00_1D50B9A3.png" width="550" height="190" /></a></p>  <p>I will enter ‘testing’ in the ‘Deployment name’ field. I need to upload the package and configuration files that I have created in Step 1. For uploading the package, I will click on the ‘From Local’ button for that row. I will browse to the ‘app.publish’ folder and select the ‘RandomNumbers’ file. Note that it has a ‘.cspkg’ extension. In a similar fashion, I will select the ‘ServiceConfiguration.Cloud.cscfg’ from the local folder for the Configuration field. </p>  <p>&#160;</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/3362.image_2403C326.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/3362.image_5F00_2403C326.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/3264.image_thumb_58A41F61.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/3264.image_5F00_thumb_5F00_58A41F61.png" width="544" height="291" /></a></p>  <p>You need to check the ‘Deploy even if one or more roles contain a single instance’ and hit the button on the bottom right corner to start deployment.</p>  <p>&#160;</p>  <p>Within few seconds your code will be deployed and the service will be up and running. You will see notifications similar to the ones below:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/3264.image_4A65A671.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/3264.image_5F00_4A65A671.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/8176.image_thumb_36D846D0.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/8176.image_5F00_thumb_5F00_36D846D0.png" width="560" height="139" /></a></p>  <p>Now, I can browse to my service by using the link: ‘<a title="https://randomnumbers.cloudapp.net/RandomNumbers.svc" href="https://randomnumbers.cloudapp.net/RandomNumbers.svc">https://randomnumbers.cloudapp.net/RandomNumbers.svc</a>’. You can get the link for your site URL by navigating to the Dashboard of ‘randomnumbers’ and in the quick glance section on the right. </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/1207.image_5A253B75.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/1207.image_5F00_5A253B75.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/0045.image_thumb_49E94DAF.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/0045.image_5F00_thumb_5F00_49E94DAF.png" width="564" height="180" /></a></p>  <p>Once you go to the web address mentioned under site URL, you see some files listed similar to as shown below:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/1538.image_704B30FA.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/1538.image_5F00_704B30FA.png"><img title="image" style="margin: 0px; display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/7571.image_thumb_341F6552.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/7571.image_5F00_thumb_5F00_341F6552.png" width="202" height="99" /></a></p>  <p>And then you can click on the ‘RandomNumbers.svc’ to navigate to the service. </p>  <h4>Step 3: Using the service in your Windows 8 Store App</h4>  <p>Using the service in Windows 8 Store App is very easy. I have created a project in Visual Studio 2012 using the ‘Blank App’ template.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/8475.image_483881DB.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/8475.image_5F00_483881DB.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/6013.image_thumb_4DA6F27F.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/6013.image_5F00_thumb_5F00_4DA6F27F.png" width="530" height="191" /></a></p>  <p>As a next step I right click on my Project in Solution Explorer and click on ‘Add Service Reference’. A dialog similar to one below pops up:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/1134.image_04A0D0B9.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/1134.image_5F00_04A0D0B9.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/2703.image_thumb_63AD5E11.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/2703.image_5F00_thumb_5F00_63AD5E11.png" width="516" height="342" /></a></p>  <p>I have the web link to the service from Step 2. ‘<a title="https://randomnumbers.cloudapp.net/RandomNumbers.svc" href="https://randomnumbers.cloudapp.net/RandomNumbers.svc">https://randomnumbers.cloudapp.net/RandomNumbers.svc</a>’. I will enter it in the Address field of the screen shown above and hit the ‘GO’ button. It will then look for the service and retrieve information about the interface and the operations exposed. I can then hit the ‘OK’ button and continue.</p>  <p>For demonstrating simple call to the service, I am calling the service in OnNavigatedTo() method on MainPage.xaml.cs. In the following code, I call the GetNumberAsync() method of the service that I created in Step 1 that generates random numbers. After I get a random number from the service I am updating the text field of my TextBlock element named ‘RandomNumberField’ on MainPage.xaml.</p>  <p>&#160;</p>  <p style="background-color: rgb(244, 244, 244);">C#</p>  <div style="background-color: rgb(244, 244, 244);">   <p>RandomNumberConsumer.ServiceReference1.RandomNumbersClient client = new ServiceReference1.RandomNumbersClient();</p>    <p>this.RandomNumberField.Text = await client.GetNumberAsync();      <br /> await client.CloseAsync();       <br /></p> </div>  <p>You are now ready to run the App and see it in action. </p>  <p>&#160;</p>  <p>For more details on the process of creating and deploying WCF service on Windows Azure: </p>  <p><a title="https://aka.ms/WCFserviceOnAzure" href="https://aka.ms/WCFserviceOnAzure">https://aka.ms/WCFserviceOnAzure</a></p>  <p>Also refer the following link for more information on building a client application for WCF service:</p>  <p><a title="https://aka.ms/ClientForWCF" href="https://aka.ms/ClientForWCF">https://aka.ms/ClientForWCF</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Using WinRT’s WebAuthenticationBroker with Flickr’s OAuth API – Part 2</title>
      <link>https://docs.microsoft.com/archive/blogs/nishasingh/using-winrts-webauthenticationbroker-with-flickrs-oauth-api-part-2</link>
      <pubDate>Tue, 09 Oct 2012 09:43:00 GMT</pubDate>
      <dc:creator><![CDATA[Nisha Singh]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/nishasingh/2012/10/09/using-winrts-webauthenticationbroker-with-flickrs-oauth-api-part-2/</guid>
      <description><![CDATA[Part 2: Get User’s Authorization and Exchange Request Token for an Access Token  In the first part...]]></description>
      <content:encoded><![CDATA[<h4>Part 2: Get User’s Authorization and Exchange Request Token for an Access Token</h4>  <p>In the <a href="https://blogs.msdn.com/b/nishasingh/archive/2012/09/24/using-winrt-s-webauthenticationbroker-with-flickr-s-oauth-api.aspx">first</a> part of this article, I discussed obtaining the Request Token during the authentication process using OAuth protocol in a sample Windows Store App for Windows 8.</p>  <p>In this part, I’ll discuss the next two steps in the authentication flow for OAuth 1.0:</p>  <ol>   <li><a href="https://www.flickr.com/services/api/auth.oauth.html#request_token">Get a Request Token</a></li>    <li><a href="https://www.flickr.com/services/api/auth.oauth.html#authorization">Get the User's Authorization</a></li>    <li><a href="https://www.flickr.com/services/api/auth.oauth.html#access_token">Exchange the Request Token for an Access Token</a></li> </ol>  <p>&#160;</p>  <h4>2. Get the User’s Authorization</h4>  <p>After receiving the Request Token, we need to send it to Flickr’s API for User’s authorization. The Request Token is sent by appending it to the query string of the following URL with optional ‘perms’ argument.</p>  <p>Sample URL to get User authorization:</p>  <p><a href="https://secure.flickr.com/services/oauth/authorize?oauth_token=87634kjbkjhuy89369hjkh&amp;perms=write">https://secure.flickr.com/services/oauth/authorize?oauth_token=87634kjbkjhuy89369hjkh&amp;perms=write</a></p>  <p>I refer to the above URL as ‘Login link’ in this article. My next step would be to write a function that would return this Login link. </p>  <p>In the previous article, I discussed the process of generating the basic parameters, calculating the signed URL, and obtaining Request Token. I would be calling each of these respective methods in my GetLoginLink() method.</p>  <p style="background-color: rgb(244, 244, 244);">C#</p>  <div style="background-color: rgb(244, 244, 244);">   <p>public async static Task&lt;string&gt; GetLoginLink()      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; string baseUrlForRequestToken = &quot;<a href="https://secure.flickr.com/services/oauth/request_token%22;">https://secure.flickr.com/services/oauth/request_token&quot;;</a>       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Get basic parameters       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Dictionary&lt;string, string&gt; parameters = OAuth1Helper.GetOAuthParameters(apikey, redirectUrl);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Get signed url       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; string signedUrl = OAuth1Helper.CalculateOAuthSignedUrl(parameters, baseUrlForRequestToken, secretkey, false);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //send the signed url to flickr       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; string response = await OAuth1Helper.GetResponseFromWeb(signedUrl);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; OAuth1Helper.SetRequestToken(response);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return &quot;<a href="https://secure.flickr.com/services/oauth/authorize?oauth_token=&quot;">https://secure.flickr.com/services/oauth/authorize?oauth_token=&quot;</a> + OAuth1Helper.OAuth_token + &quot;&amp;perms=write&quot;;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p> </div>  <p><i>Figure 1: Get the Login link</i></p>  <p>Going back to the topic of WebAuthenticationBroker discussed in part 1, I went over the parameters that I needed before I call WebAuthenticationBroker’s AuthenticateAsync() method. Now that I have all my parameters ready, I’ll write my event handler for the Login button as follows:</p>  <p style="background-color: rgb(244, 244, 244);">C#</p>  <div style="background-color: rgb(244, 244, 244);">   <p>private async void loginButtonClicked(object sender, RoutedEventArgs e)      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; string output;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Uri flickrUri = new Uri(await SampleDataSource.GetLoginLink());       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; WebAuthenticationResult webAuthenticationResult = await WebAuthenticationBroker.AuthenticateAsync(       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; WebAuthenticationOptions.None,       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; flickrUri, new Uri(SampleDataSource.redirectUrl));</p>    <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (webAuthenticationResult.ResponseStatus == WebAuthenticationStatus.Success)      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; output = webAuthenticationResult.ResponseData.ToString();       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; await SampleDataSource.GetAccessToken(output);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.DefaultViewModel[&quot;MessageDisplay&quot;] = true;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.DefaultViewModel[&quot;Message&quot;] = &quot;Welcome, &quot; + SampleDataSource.username + &quot;!&quot;;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.DefaultViewModel[&quot;DisplayLogin&quot;] = false;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else if (webAuthenticationResult.ResponseStatus == WebAuthenticationStatus.ErrorHttp)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; output = &quot;HTTP Error returned by AuthenticateAsync() : &quot; + webAuthenticationResult.ResponseErrorDetail.ToString();       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else if (webAuthenticationResult.ResponseStatus == WebAuthenticationStatus.UserCancel)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; output = &quot;Authentication process was cancelled by the user&quot;;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p> </div>  <p><i>Figure 2: Event handler for Login button</i></p>  <p>When I hit the Login button, I am navigated to the following screen:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/7853.image5_thumb_7678E811.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/7853.image5_5F00_thumb_5F00_7678E811.png"><img title="image5_thumb" style="margin: 0px; border: 0px currentcolor; display: inline; background-image: none;" border="0" alt="image5_thumb" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/2148.image5_thumb_thumb_1D46FE52.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/2148.image5_5F00_thumb_5F00_thumb_5F00_1D46FE52.png" width="556" height="439" /></a></p>  <p><i>Figure 3: Login screen in the App container</i></p>  <p>I enter my enter credentials and hit the Sign In button.</p>  <p>After I am successfully logged in, the following screen appears: </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/5775.image_thumb4_2B19444D.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/5775.image_5F00_thumb4_5F00_2B19444D.png"><img title="image_thumb[4]" style="margin: 0px; border: 0px currentcolor; display: inline; background-image: none;" border="0" alt="image_thumb[4]" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/4705.image_thumb4_thumb_23FA07D5.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/4705.image_5F00_thumb4_5F00_thumb_5F00_23FA07D5.png" width="578" height="405" /></a></p>  <p><i>Figure 4: User Authorization screen – User authorizes the Request Token</i></p>  <p>When I hit the “OK, I’ll AUTHORIZE IT” button, Flickr authorizes the Request Token that I obtained in the Step 1 and sends back an authorized Request Token. The response sent back by the Flickr API gets populated in&#160; webAuthenticationResult.ResponseData (as shown in Figure 2). </p>  <p>Sample response returned by Flickr looks similar to this:</p>  <p style="background-color: rgb(244, 244, 244);">&lt;redirect URL placeholder&gt;?oauth_token=3345464353453458-022bbgttyt3542f3432 &amp;oauth_verifier=45dererer6b67074 </p>  <h4>3. Exchange Request Token for Access Token</h4>  <p>As a next step in this process, I need to parse the response received in the above step and extract the authorized Request Token and prepare for exchanging it with Access Token. To get the Access Token I need to follow the same steps as needed for obtaining the Request Token (discussed in part 1). They are:</p>  <ol>   <li>Get basic parameters</li>    <li>Calculate signed URL</li>    <li>Send the signed URL and get response</li>    <li>Parse the response and extract Token</li> </ol>  <p>The base URL for Access Token would be:</p>  <p><a href="https://secure.flickr.com/services/oauth/access_token%22;">https://secure.flickr.com/services/oauth/access_token</a></p>  <p>The following method parses the response string, extracts the oauth_token and oauth_verifier received in Step 2, and calculates the signed URL. This signed URL is finally passed on to the Flickr’s API and the Request Token is exchanged for Access token. Besides the CalculateAccessToken() method defined in Figure 6, rest of the methods are defined in part 1 of this article series.</p>  <p style="background-color: rgb(244, 244, 244);">C#</p>  <div style="background-color: rgb(244, 244, 244);">   <p>public static async Task GetAccessToken(string responseData)      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; string oauth_token = null;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; string oauth_verifier = null;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; String[] keyValPairs = responseData.Split('&amp;');       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; string baseUrlForAccessToken = &quot;<a href="https://secure.flickr.com/services/oauth/access_token%22;">https://secure.flickr.com/services/oauth/access_token&quot;;</a>       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //parses the response string       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; for (int i = 0; i &lt; keyValPairs.Length; i++)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; String[] splits = keyValPairs[i].Split('=');       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (splits[0].Contains(&quot;oauth_token&quot;))       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; oauth_token = splits[1];       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else if (splits[0].Contains(&quot;oauth_verifier&quot;))       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; oauth_verifier = splits[1];       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>    <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Get basic parameters      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Dictionary&lt;string, string&gt; parameters = OAuth1Helper.GetOAuthParameters(apikey, redirectUrl);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; parameters.Add(&quot;oauth_verifier&quot;, oauth_verifier);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; parameters.Add(&quot;oauth_token&quot;, oauth_token);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; string signedUrl = OAuth1Helper.CalculateOAuthSignedUrl(parameters, baseUrlForAccessToken, secretkey, true);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; string response = await OAuth1Helper.GetResponseFromWeb(signedUrl);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; CalculateAccessToken(response);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>    <p>&#160;</p> </div>  <p><em>Figure 5: Exchange Request Token for Access Token</em></p>  <p>Sample response from <a href="https://www.flickr.com/services/api/auth.oauth.html">Flickr</a> containing the Access Token looks similar to this:</p>  <div style="background-color: rgb(244, 244, 244);">fullname=Jamal%20Fanaian&amp; oauth_token=72157626318069415-087bfc7b5816092c &amp; oauth_token_secret=a202d1f853ec69de&amp; user_nsid=21207597%40N07&amp; username=jamalfanaian </div>  <p>After I receive a response from the Flickr API, I need to extract the Access Token and save it for sending authorized requests to Flickr APIs’.</p>  <p style="background-color: rgb(244, 244, 244);">C#</p>  <div style="background-color: rgb(244, 244, 244);">   <p>public static void CalculateAccessToken(string responseData)      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; String accessToken = null;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; String accessTokenSecret = null;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; String[] keyValPairs = responseData.Split('&amp;');       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; string username = string.Empty;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; for (int i = 0; i &lt; keyValPairs.Length; i++)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; String[] splits = keyValPairs[i].Split('=');       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; switch (splits[0])       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; case &quot;oauth_token&quot;:       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; accessToken = splits[1];       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; break;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; case &quot;oauth_token_secret&quot;:       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; accessTokenSecret = splits[1];       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; break;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; case &quot;username&quot;:       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; username = splits[1];       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; break;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // Set current access token.       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; SampleDataSource.flickr.OAuthAccessToken = accessToken;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; SampleDataSource.flickr.OAuthAccessTokenSecret = accessTokenSecret;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; SampleDataSource.username = username;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Windows.Storage.ApplicationDataContainer roamingSettings = Windows.Storage.ApplicationData.Current.RoamingSettings;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Windows.Storage.ApplicationDataCompositeValue composite = new Windows.Storage.ApplicationDataCompositeValue();       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; composite[&quot;accessToken&quot;] = accessToken;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; composite[&quot;accessTokenSecret&quot;] = accessTokenSecret;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; composite[&quot;username&quot;] = username;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; roamingSettings.Values[&quot;accessCompositeSetting&quot;] = composite;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p> </div>  <p><em>Figure 6: Extract and Save the Access Token</em></p>  <p>In my App, I load the application settings next time the App loads and retrieve the credentials as shown below:</p>  <p style="background-color: rgb(244, 244, 244);">C#</p>  <div style="background-color: rgb(244, 244, 244);">   <p>public static void RetrieveCredentials()      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Windows.Storage.ApplicationDataContainer roamingSettings = Windows.Storage.ApplicationData.Current.RoamingSettings;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Windows.Storage.ApplicationDataCompositeValue composite =       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; (Windows.Storage.ApplicationDataCompositeValue)roamingSettings.Values[&quot;accessCompositeSetting&quot;];</p>    <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (composite == null)      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; SampleDataSource.isUserAuthenticated = false;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; SampleDataSource.isUserAuthenticated = true;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; SampleDataSource.username = composite[&quot;username&quot;].ToString();       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; SampleDataSource.flickr.OAuthAccessToken = composite[&quot;accessToken&quot;].ToString();       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; SampleDataSource.flickr.OAuthAccessTokenSecret = composite[&quot;accessTokenSecret&quot;].ToString();       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p> </div>  <p>Once the credentials are retrieved, subsequent calls can be made to the various Flickr APIs’ for data exchange. </p>  <p>Here is an example call using the Access Token to the <a href="https://www.flickr.com/services/api/flickr.test.login.html">flickr.test.login</a> API listed on the Flickr’s <a href="https://www.flickr.com/services/api/auth.oauth.html">website</a>:</p>  <div style="background-color: rgb(244, 244, 244);">https://api.flickr.com/services/rest ?nojsoncallback=1 &amp;oauth_nonce=84354935&amp; format=json&amp; oauth_consumer_key=653e7a6ecc1d528c516cc8f92cf98611&amp; oauth_timestamp=1305583871&amp; oauth_signature_method=HMAC-SHA1&amp; oauth_version=1.0&amp; oauth_token=72157626318069415-087bfc7b5816092c&amp; oauth_signature=dh3pEH0Xk1qILr82HyhOsxRv1XA%3D&amp; method=flickr.test.login </div>  <p>You may want to check Flickr’s <a href="https://www.flickr.com/services/api/auth.spec.html">documentation</a> to further understand the use of tokens in your calls to the Flickr API for data exchange.</p>  <p>&#160;</p>  <h4>Resources:</h4>  <ul>   <li>I have used the Web authentication broker sample provided <a href="https://code.msdn.microsoft.com/windowsapps/Web-Authentication-d0485122">here</a>.</li>    <li>I have used <a href="https://flickrnet.codeplex.com/">Flickr.Net</a> library listed on their <a href="https://www.flickr.com/services/api/">website</a> for making API calls.</li> </ul>]]></content:encoded>
    </item>
    <item>
      <title>Using WinRT’s WebAuthenticationBroker with Flickr’s OAuth API</title>
      <link>https://docs.microsoft.com/archive/blogs/nishasingh/using-winrts-webauthenticationbroker-with-flickrs-oauth-api</link>
      <pubDate>Mon, 24 Sep 2012 11:52:09 GMT</pubDate>
      <dc:creator><![CDATA[Nisha Singh]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/nishasingh/2012/09/24/using-winrts-webauthenticationbroker-with-flickrs-oauth-api/</guid>
      <description><![CDATA[Part 1: Get a Request Token  For one of my first apps at Microsoft, I decided to build a Windows...]]></description>
      <content:encoded><![CDATA[<h4>Part 1: Get a Request Token</h4>  <p>For one of my first apps at Microsoft, I decided to build a Windows Store App that would exchange data via Flickr’s APIs. One of the challenges I faced while developing this App was communicating with Flickr’s APIs that require authentication via OAuth protocol. WinRT’s WebAuthenticationBroker API helped me in facilitating the authentication process between the App and Flickr’s OAuth service. For more information on how WebAuthenticationBroker works, please refer this <a href="https://msdn.microsoft.com/en-us/library/windows/apps/Hh750286.aspx">article</a> on MSDN. The OAuth authentication flow is explained in 3 three steps on the Flickr’s <a href="https://www.flickr.com/services/api/auth.oauth.html">website</a>:</p>  <ol>   <li><a href="https://www.flickr.com/services/api/auth.oauth.html#request_token">Get a Request Token</a></li>    <li><a href="https://www.flickr.com/services/api/auth.oauth.html#authorization">Get the User's Authorization</a></li>    <li><a href="https://www.flickr.com/services/api/auth.oauth.html#access_token">Exchange the Request Token for an Access Token</a></li> </ol>  <p>I have divided this article in 2 parts based on the above authentication flow. In the first part, I’ll discuss the first step in the OAuth 1.0 authentication flow. In the second part, I’ll discuss the remaining two steps of authentication flow. Towards the end of the second part, I’ll also discuss about saving the token associated with the user to maintain their authentication status the next time they launch the App. Overall in the two parts, I have demonstrated the usage of WebAuthenticationBroker against Flickr’s OAuth service in a sample Windows Store App for Windows 8. </p>  <h4>1. Get a Request Token</h4>  <p>A user can be prompted for authentication at various points in an app like file upload, writing comments for a photo, tagging a photo etc. In my App, I use WebAuthenticationBroker in a scenario in which the user hits the login button in the sample Flickr App.</p>&#160;&#160; When users hit the Login button in the sample App, they are navigated to the following screen:&#160; <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/3513.image5_2DFA4FF9.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/3513.image5_5F00_2DFA4FF9.png"><img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/4174.image5_thumb_69B9E8AC.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/4174.image5_5F00_thumb_5F00_69B9E8AC.png" width="556" height="439" /></a></p>  <p><em>Figure 2: Login page displayed in a App container</em></p>  <p>Before we proceed to the next step of entering the credentials in the login page, let’s analyze what happened behind the scenes.</p>  <p>In the event handler for the Login button, a call was made to WebAuthenticationBroker’s AuthenticateAsync method. The AuthenticateAsync method renders the login screen in the App container by using the Flickr’s OAuth service. The method accepts three arguments i.e. <i>options, requestUri, callbackUri.</i> I have set <i>options</i> to WebAuthenticationOptions.None and <i>callbackUri</i> to the value returned from WebAuthenticationBroker.GetCurrentApplicationCallbackUri().<i> </i>But I need to pass a <i>requestUri</i> too. </p>  <p>A <i>requestUri</i> is the URL that loads the Login page for user and is the second step in the OAuth flow. A <i>requestUri</i> should be something similar to this: “https://secure.flickr.com/services/oauth/authorize?oauth_token=72157626737672178-022bbd2f4c2f3432&amp;perms=write”. The value of oauth_token mentioned as part of the query string is the value of the Request token received from Flickr. </p>  <p>That means that before we can call WebAuthenticationBroker’s AuthenticateAsync method we need to first get a Request token from the Flickr OAuth API. </p>  <p>A Request token is a temporary token that will be used to authenticate the user to the application using the <a href="https://www.flickr.com/services/apps/create/apply">API key</a>. In the third step of the OAuth flow, you will see that the Request token will be exchanged for an Access token. </p>  <p>To retrieve the Request token Flickr expects the request URL to be similar to this:</p>  <p style="background-color: rgb(244, 244, 244);">https://secure.flickr.com/services/oauth/request_token ?oauth_nonce=95613465 &amp;oauth_timestamp=1305586162 &amp;oauth_consumer_key=653e7a6ecc1d528c516cc8f92cf98611 &amp;oauth_signature_method=HMAC-SHA1 &amp;oauth_version=1.0 &amp;oauth_signature=7w18YS2bONDPL%2FzgyzP5XTr5af4%3D &amp;oauth_callback=http%3A%2F%2Fwww.example.com </p>  <p><em>Figure 3: Sample signed URL for Request token</em></p>  <p>The above URL’s query string can be characterized as having some basic parameters (name – value pairs) and a signature parameter. The basic parameters are used for constructing the signature. To know more in detail on this topic, please refer <a href="https://www.flickr.com/services/api/auth.oauth.html">this</a> article’s ‘Signing Requests’ section. </p>  <p>In this article, I will briefly go over the steps but will definitely touch the coding part of it. To generate the Request token URL (Figure 3), I follow these steps:</p>  <h5>a. Generate basic parameters for Flickr OAuth API</h5>  <p>I need to first generate basic parameters for the Request token’s http request. With reference to the<i> </i><a href="https://www.flickr.com/services/api/auth.oauth.html#request_token">Flickr</a><i> </i>OAuth API, this is how they expect the basic parameters to look like:</p>  <p style="background-color: rgb(244, 244, 244);">oauth_nonce=89601180    <br />oauth_timestamp=1305583298     <br />oauth_consumer_key=653e7a6ecc1d528c516cc8f92cf98611     <br />oauth_signature_method=HMAC-SHA1     <br />oauth_version=1.0     <br />oauth_callback=http%3A%2F%2Fwww.example.com </p>  <p>&#160;</p>  <p>The below function creates a dictionary of basic parameters as per the above parameters<i>:</i></p>  <p style="background-color: rgb(244, 244, 244);">C#</p>  <p style="background-color: rgb(244, 244, 244);">public static Dictionary&lt;string,string&gt; GetOAuthParameters(string apikey, string callbackUrl)    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Random random = new Random();     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; DateTime epochDate = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; TimeSpan timespan = DateTime.UtcNow - epochDate;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; string oauthTimestamp = timespan.TotalSeconds.ToString(System.Globalization.NumberFormatInfo.InvariantInfo);     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; string oauthNonce = random.Next(1000).ToString();     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Dictionary&lt;string, string&gt; parameters = new Dictionary&lt;string, string&gt;();     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; parameters.Add(&quot;oauth_nonce&quot;, oauthNonce);     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; parameters.Add(&quot;oauth_timestamp&quot;, oauthTimestamp);     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; parameters.Add(&quot;oauth_consumer_key&quot;, apikey);     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; parameters.Add(&quot;oauth_signature_method&quot;, &quot;HMAC-SHA1&quot;);     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; parameters.Add(&quot;oauth_version&quot;, &quot;1.0&quot;);     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; parameters.Add(&quot;oauth_callback&quot;, callbackUrl);     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return parameters;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>  <p><i>Figure 4: Get basic parameters</i></p>  <div style="background-color: rgb(234, 241, 221);">   <p><em>Note: </em></p>    <ul>     <li><em>The redirect URL or callback URL used in all the places has been set to the string returned from WebAuthenticationBroker.GetCurrentApplicationCallbackUri().ToString().</em></li>      <li><em>The variable “apikey” is set to the value of the API key that you receive when you </em><a href="https://www.flickr.com/services/apps/create/apply">register</a><em> for an app on the Flickr website.</em></li>   </ul> </div>  <h5>b. Calculate signed URL</h5>  <p>Once I have the basic parameters, I need to sort them and create a base string in the form of:</p>  <p style="background-color: rgb(244, 244, 244);">GET&amp;https%3A%2F%2Fsecure.flickr.com%2Fservices%2Foauth%2Frequest_token&amp;oauth_callback%3Dms-app%253A%252F%252Fs-1-15-2-452505077-3210332440-309548214-3674837716-3057654506-2702161574-51733630%252F%26oauth_consumer_key%3Dsdsdsdsdsdsdwdwdw%26oauth_nonce%3D246%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1348034567.41827%26oauth_version%3D1.0</p>  <p>Using the base string as the ‘text’ and the consumer secret key as the ‘key’, we then need to calculate the signature using HMAC-SHA1 encryption. The consumer secret key is one of the keys that you receive when you <a href="https://www.flickr.com/services/apps/create/apply">register</a> for an App on the Flickr website. </p>  <p>The next thing would be to put together the base URL for Request token (<a href="https://secure.flickr.com/services/oauth/request_token">https://secure.flickr.com/services/oauth/request_token</a>), basic parameters and signature to generate a signed Request token URL as shown in Figure 3.</p>  <p>The method below helps me achieve that. I provide the basic parameters, Request Token base URL, secret key, and the bool parameter as ‘false’ to the method. And it returns the signed URL for obtaining Request token that is ready to be sent to the Flickr’s API. I would also use the below (CalculateOAuthSignedUrl()) method in the exchange of Request token for Access token step. That’s where I would call the method with the ‘exchangeStep’ parameter as ‘true’.</p>  <p>&#160;</p>  <p style="background-color: rgb(244, 244, 244);"><em>C#</em><em></em></p>  <div style="background-color: rgb(244, 244, 244);">   <p>public static string CalculateOAuthSignedUrl(Dictionary&lt;string,string&gt; parameters, string url, string secretKey, bool exchangeStep)      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; StringBuilder baseString = new StringBuilder();       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; string baseStringForSig;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; SortedDictionary&lt;string, string&gt; sortedParams =&#160; new SortedDictionary&lt;string,string&gt;();       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; IBuffer keyMaterial;</p>    <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; foreach (var param in parameters)      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; sortedParams.Add(param.Key, param.Value);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>    <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; foreach (var param in sortedParams)      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; baseString.Append(param.Key);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; baseString.Append(&quot;=&quot;);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; baseString.Append(Uri.EscapeDataString(param.Value));       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; baseString.Append(&quot;&amp;&quot;);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //removing the extra ampersand       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; baseString.Remove(baseString.Length - 1, 1);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; baseStringForSig = &quot;GET&amp;&quot; + Uri.EscapeDataString(url) + &quot;&amp;&quot; + Uri.EscapeDataString(baseString.ToString());</p>    <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //calculating the signature      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; MacAlgorithmProvider HmacSha1Provider = MacAlgorithmProvider.OpenAlgorithm(&quot;HMAC_SHA1&quot;);</p>    <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (exchangeStep)      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; keyMaterial = CryptographicBuffer.ConvertStringToBinary(secretKey + &quot;&amp;&quot; + OAuth_token_secret, BinaryStringEncoding.Utf8);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; keyMaterial = CryptographicBuffer.ConvertStringToBinary(secretKey + &quot;&amp;&quot;, BinaryStringEncoding.Utf8);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>    <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; CryptographicKey cryptoKey = HmacSha1Provider.CreateKey(keyMaterial);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; IBuffer dataString = CryptographicBuffer.ConvertStringToBinary(baseStringForSig, BinaryStringEncoding.Utf8);</p>    <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return url + &quot;?&quot; + baseString.ToString() + &quot;&amp;oauth_signature=&quot; +      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Uri.EscapeDataString(CryptographicBuffer.EncodeToBase64String(CryptographicEngine.Sign(cryptoKey, dataString)));       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p> </div>  <p><em>Figure 5: Calculate signed URL</em></p>  <h5>c. Send the signed URL and get the response</h5>  <p>Once we have the signed URL for obtaining Request token, we are ready to send it the Flickr OAuth API. I use the method below for exchanging request/response from the Flickr’s API:</p>  <p style="background-color: rgb(244, 244, 244);">C#<em></em></p>  <p style="background-color: rgb(244, 244, 244);">public async static Task&lt;string&gt; GetResponseFromWeb(string url)    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; HttpWebRequest Request = (HttpWebRequest)WebRequest.Create(url);     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; string httpResponse = null;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Request.Method = &quot;GET&quot;;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; HttpWebResponse response = (HttpWebResponse)await Request.GetResponseAsync();     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (response != null)     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; StreamReader data = new StreamReader(response.GetResponseStream());     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; httpResponse = await data.ReadToEndAsync();     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return httpResponse;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>  <p><em>Figure 6: Get http response from web</em><em></em></p>  <h5>d. Parse the http response and extract the Request token</h5>  <p>Flickr returns a response similar to the one below:</p>  <p style="background-color: rgb(244, 244, 244);">oauth_callback_confirmed=true &amp;oauth_token=72157626737672178-022bbd2f4c2f3432 &amp;oauth_token_secret=fccb68c4e6103197</p>  <p>I parse the response and extract the Request token:</p>  <p style="background-color: rgb(244, 244, 244);">public static void SetRequestToken(string response)    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; string [] keyValPairs = response.Split('&amp;');     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; for (int i = 0; i &lt; keyValPairs.Length; i++)     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; String[] splits = keyValPairs[i].Split('=');     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; switch(splits[0])     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; case &quot;oauth_token&quot;:     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; OAuth_token = splits[1];     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; break;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; case &quot;oauth_token_secret&quot;:     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; OAuth_token_secret = splits[1];     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; break;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>  <p>In the part 2 of this article, I will use the Request token extracted above for step 2 &amp; 3 of the OAuth flow i.e. for user authorization purposes and eventually exchanging the Request token with Access token.</p>]]></content:encoded>
    </item>
    <item>
      <title>My first blog entry!!</title>
      <link>https://docs.microsoft.com/archive/blogs/nishasingh/my-first-blog-entry</link>
      <pubDate>Wed, 05 Sep 2012 16:56:58 GMT</pubDate>
      <dc:creator><![CDATA[Nisha Singh]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/nishasingh/2012/09/05/my-first-blog-entry/</guid>
      <description><![CDATA[Hi, I am Nisha Singh! I recently joined Microsoft as a Developer Evangelist at Redmond. To get...]]></description>
      <content:encoded><![CDATA[<p>Hi, I am Nisha Singh! I recently joined Microsoft as a Developer Evangelist at Redmond. To get myself kick started, I have been building Windows 8 apps. And I am very excited about sharing some of my learnings in the process of development. </p>  <p>I am a graduate from University of Washington in the field of Information Management and a Bachelors in Engineering from University of Mumbai. I have been living in Seattle for close to two years now and enjoying the awesome weather <img class="wlEmoticon wlEmoticon-smile" alt="Smile" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/22/metablogapi/4784.wlEmoticon-smile_1945C479.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-22-metablogapi/4784.wlEmoticon_2D00_smile_5F00_1945C479.png" />! </p>]]></content:encoded>
    </item>
  </channel>
</rss>