<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Tatham Oddie &#187; Components</title>
	<atom:link href="http://blog.tatham.oddie.com.au/category/components/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.tatham.oddie.com.au</link>
	<description>Enter the Tatrix</description>
	<lastBuildDate>Sun, 21 Feb 2010 10:43:51 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='blog.tatham.oddie.com.au' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/0b67dd1962a151d7e1d78a45055c6b6d?s=96&#038;d=http://s2.wp.com/i/buttonw-com.png</url>
		<title>Tatham Oddie &#187; Components</title>
		<link>http://blog.tatham.oddie.com.au</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blog.tatham.oddie.com.au/osd.xml" title="Tatham Oddie" />
	<atom:link rel='hub' href='http://blog.tatham.oddie.com.au/?pushpress=hub'/>
		<item>
		<title>Managed Wrappers for Windows Live Data</title>
		<link>http://blog.tatham.oddie.com.au/2007/08/07/managed-wrappers-for-windows-live-data/</link>
		<comments>http://blog.tatham.oddie.com.au/2007/08/07/managed-wrappers-for-windows-live-data/#comments</comments>
		<pubDate>Tue, 07 Aug 2007 02:54:51 +0000</pubDate>
		<dc:creator>Tatham Oddie</dc:creator>
				<category><![CDATA[Components]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Windows Live]]></category>

		<guid isPermaLink="false">http://blog.tatham.oddie.com.au/2007/08/07/managed-wrappers-for-windows-live-data/</guid>
		<description><![CDATA[Windows Live Data is the API you use for delegated access to your user&#8217;s personal data like contacts. It&#8217;s a pretty simple API, however that hasn&#8217;t stopped me writing some components for it! Today, I&#8217;m releasing them publicly.
Not only do these components make it easier to work with the API, but they also provide an [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.tatham.oddie.com.au&blog=171289&post=192&subd=tatham&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://msdn2.microsoft.com/en-us/library/bb447720.aspx" target="_blank">Windows Live Data</a> is the API you use for delegated access to your user&#8217;s personal data like contacts. It&#8217;s a pretty simple API, however that hasn&#8217;t stopped me writing some components for it! Today, I&#8217;m releasing them publicly.</p>
<p>Not only do these components make it easier to work with the API, but they also provide an abstraction layer so that as the API develops your application doesn&#8217;t necessarily have to.</p>
<p><em>(Note: This post assumes an understanding for the Windows Live Data API. If you&#8217;ve never touched it before, </em><a href="http://msdn2.microsoft.com/en-us/library/bb447720.aspx" target="_blank"><em>read this first</em></a><em>.)</em></p>
<p>First up is the PermissionRequestHyperLink control. Placing this on your page gives you a nice designer experience for building those yucky URLs and setting all the right flags.</p>
<p>A basic request looks something like this:</p>
<blockquote><p>&lt;live:PermissionRequestHyperLink id=&#8221;PermissionRequestHyperLink1&#8243; runat=&#8221;server&#8221; Permission=&#8221;LiveContacts_ReadOnly&#8221; PrivacyUrl=&#8221;~/WindowsLive/PrivacyPolicy.aspx&#8221; ReturnUrl=&#8221;~/WindowsLive/ResponseHandler.ashx&#8221;&gt;Permission Request&lt;/live:permissionrequesthyperlink&gt;</p>
</blockquote>
<p>And gives you designer experience like this:</p>
<blockquote><p><a href="http://tatham.files.wordpress.com/2007/08/image.png"><img alt="image" src="http://tatham.files.wordpress.com/2007/08/image-thumb.png?w=700"/></a> </p>
<p><a href="http://tatham.files.wordpress.com/2007/08/image1.png"><img alt="image" src="http://tatham.files.wordpress.com/2007/08/image-thumb1.png?w=700"/></a> </p>
</blockquote>
<p>Next up is the response handler base class. Start by adding a new &#8216;generic handler&#8217; to your project:</p>
<blockquote><p><a href="http://tatham.files.wordpress.com/2007/08/image2.png"><img alt="image" src="http://tatham.files.wordpress.com/2007/08/image-thumb2.png?w=700"/></a></p>
</blockquote>
<p>Change the generated class to inherit from PermissionResponseHandler instead of IHttpHandler, then implement the ProcessResponse and ProcessFailure&nbsp;methods like so:</p>
<blockquote><p>public class ResponseHandler : PermissionResponseHandler<br />{<br />&nbsp;&nbsp;&nbsp; protected override void ProcessResponse(HttpContext context, PermissionResponse response)<br />&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //Do something here like storing the token for future use<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //response.DomainAuthenticationToken<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //response.OwnerHandle<br />&nbsp;&nbsp;&nbsp; }  </p>
<p>&nbsp;&nbsp;&nbsp; protected override void ProcessFailure(HttpContext context, PermissionResponseCode responseCode)<br />&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //Perform some nice handling here<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //responseCode<br />&nbsp;&nbsp;&nbsp; }<br />}</p>
</blockquote>
<p>How easy is that!  </p>
<p>You can grab the code from <a href="http://svn.fueladvance2.com/FuelAdvance.Components/trunk/">http://svn.fueladvance2.com/FuelAdvance.Components/trunk/</a> (username: anonymous). You&#8217;ll find the components in the FuelAdvance.Components.Web.WindowsLive namespace. </p>
<p>If you&#8217;re using Subversion yourself, remember that you can configure this as an svn:external and then you&#8217;ll always be running the latest version. </p>
<p>Next up, I&#8217;ll probably be releasing some managed wrappers for the Windows Live Contacts API.</p>
<p><strong>Update 9/8/07: </strong>Change SVN link to point at the solution instead of the project.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/tatham.wordpress.com/192/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/tatham.wordpress.com/192/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tatham.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tatham.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tatham.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tatham.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tatham.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tatham.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tatham.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tatham.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tatham.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tatham.wordpress.com/192/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.tatham.oddie.com.au&blog=171289&post=192&subd=tatham&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.tatham.oddie.com.au/2007/08/07/managed-wrappers-for-windows-live-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/459b8249e2b4dba8169774892cab0d48?s=96&#38;d=identicon&#38;r=PG" medium="image">
			<media:title type="html">tatham</media:title>
		</media:content>
	</item>
	</channel>
</rss>