Thursday, April 22, 2010

Introduction to querying lists with REST and ListData.svc in SharePoint 2010

http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2010/01/21/introduction-to-querying-lists-with-rest-and-listdata-svc-in-sharepoint-2010.aspx

When you are getting started, the first thing you want to do is check and see if you have ListData.svc up and running. Like any SharePoint web service, it’s located in the _vti_bin folder of any existing site, so it will work with items relative to that site. Here is what a typical URL might look like.
http:///_vti_bin/ListData.svc

To get the data for this list via REST we simply just add the list name to the URL. In my case the name of the list is called Tasks. Here is what the URL would look like.
http:///_vti_bin/ListData.svc/

you just want to know the status for a specific task (note that the site column is actually called StatusValue here), you can simply add it to the URL like this.
http:///_vti_bin/ListData.svc/()/()
In my case:
http://sp2010/_vti_bin/ListData.svc/Tasks(3)/StatusValue


You need to install ADO.NET Data Services v1.5 CTP2 on SharePoint front-end to get it working.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.