Hello again 🙂
First of all let’s define what rest stands for ! In fact REST (REpresentational State Transfer) embodies the idea of accessing data across the Internet network, referencing resources using a clear and unique syntax.
Still a bit vague i know !! But you will get it at the end of this post i promise 😉
in this walkthrough we are going to access a sharepoint List from the browser and then from a console application using Visual studio 2010.
So Lets Get Started !!
1. Defining the List:
I almost always use the same list in my post. So here it is again my favorite one Employee Review:
you can create it or use another list as you like.
2. Accessing the list from the browser:
In SharePoint 2010 we can access all SharePoint List via Restful Service. Here is the URL to access List REST Service.
For Example: my URL becomes : http://win-5g4msqldlt8/_vti_bin/ListData.svc
as you can see here i have all the lists in my site.
so now i want to see a particular list (Employee Review): My URL becomes : http://win-5g4msqldlt8/_vti_bin/ListData.svc/EmployeeReview
See how simple it is !!! and you can do all sorts of queries via URL.
3. accessing the list from a console application:
1. So lets start by opening Visual studio 2010.
2. create a console app project named Employee Review:
3. Right click on the References node in the Solution Explorer window, then click Add Service Reference.
4. Enter http://win-5g4msqldlt8/_vti_bin/ListData.svc for the address. then click GO and you will have all the lists.
5. Change the namespace from ServiceReference1 to Review.
6. now we are ready to code :
using Employee Review.Review;
static void Main(string args)
TeamSiteReviewContext dc =
new TeamSiteReviewContext(new Uri(“http://win-5g4msqldlt8/_vti_bin/ListData.svc”));
dc.Credentials = CredentialCache.DefaultNetworkCredentials;
var result = from d in dc.EmployeeReview
Name = d.EmployeeName,
Rating = d.Rating,
Comments = d.Comments,
foreach (var d in result)
and Voila you will have all the list in you console !! Good job 😉