Last week – I had the privilege of speaking at Microsoft’s
SharePoint conference in Las Vegas
.  I had a talk about Workflows in SharePoint
2010 – and had a blast at the conference.  Honestly probably the best technical
conference I’ve ever spoke at, certainly the best I’ve been to in at least 10 years.

I’m super excited about SharePoint 2010, expect more blog posts and other information
flowing from this blog RSN.

One thing I am really really excited about it is all the emphasis on REST in SharePoint
2010.  Case in point – as you can read over at the ADO.NET Data Services team
blog =  http://blogs.msdn.com/astoriateam/
SharePoint list data is going to be exposed via ADO.NET Data Services!

Just go to /_vti_bin/ListData.svc/   (note that you may have to install ADO.NET
Data Services 1.5 CTP2
if you haven’t already  as you’ll get 404 – page not
found errors if you try to hit the ListData.svc URI without it installed).

Another really cool part of this integration between ADO.NET Data Services and SharePoint
2010 is that document libraries are exposed as well -and documents are exposed as
Atom pub media links (a standard way to expose binary data as part of an atom feed).

I was playing around with this today – and wanted to blog about how to use it through
the ADO.NET generated client.  The DataServiceContext object you use to connect
to your list data has two methods :  GetReadStream, and SetSaveStream.

When you want to retrieve the document from the document library associated with a
list item, you pass the list item to GetReadStream:

 1: var
uri = new Uri("http://flash/spc/_vti_bin/ListData.svc");

 2: var
ctx = new TwiddlerDataContext(uri); 

 3: ctx.Credentials
= System.Net.CredentialCache.DefaultCredentials;

 4: var
extf = ctx.FlowTest.FirstOrDefault();

 5: var
stream = ctx.GetReadStream(extf); 

You use SetSaveStream to associate a list item with a stream that will be save as
the document.



Check out my new book on REST.