SharePoint 2010 Data Services – Part 2
Posted
Thursday, July 01, 2010 7:11 PM
by
Itay Shakury
This is the second post of a series about SharePoint 2010 Data Services: Part 1, Part 2 (this one), Part 3.
In this post we will talk about what it takes to get started with SharePoint 2010 Data Services.
Installation
As I mentioned in the fist post, in order to use Data Services with SharePoint 2010, you have to install an update for .NET framework.
The current release is called “ADO.NET Data Services Update for .NET Framework 3.5 SP1” and is available for Windows 2008 or Windows 7 here: http://www.microsoft.com/downloads/details.aspx?familyid=79d7f6f8-d6e9-4b8c-8640-17f89452148e&displaylang=en
Download the file and install it on your SharePoint machine. The installation wizard is no more than one screen with no choices. When it’s done restart the machine.
Basic Usage
The data in SharePoint lists is now accessible under the following URL: http://ServerName/SiteName/_vti_bin/listdata.svc where “ServerName” and “SiteName” are placeholders. They are required in order to establish context for the service.
All Requests are made using regular HTTP GET. The response of a Data Services list query is always an AtomPub feed or JSON.
If you typed the service URL in the address bar of your browser you should see something like this:
This is an XML response (not a feed yet) that shows all the lists that are available under the site you specified in the URL.
You can now choose a list like this: http://ServerName/SiteName/_vti_bin/listdata.svc/ListName
This will return an XML feed of all the list items in that list.
You can perform other actions like list filter sorting and paging but this is beyond the scope of this article. Basically the service should respect the oData protocol, so most of the operations that are defined in oData should be implemented the same way here. (I say should because some sections in the oData specifications are not working here.. yet).
Now that you have the items that you want, you can pass them to a web part, use them in JavaScript code, manipulate the result using XPath, or anything else.
In the next post I will talk about using Data Services as a Data Source with Visual Studio 2010.