Using Data Services over SharePoint 2010 – Part 1 – Getting Started

ADO.NET Data Services 1.5 and SharePoint 2010 allow developers to write applications against SharePoint Lists using the familiar Data Services Client programming model.


The SharePoint 2010 beta will become generally available in November.

In order to use Data Services with SharePoint 2010 Beta, ADO.NET Data Services 1.5 must be installed on your server, ideally *before* you install SharePoint 2010.

If however SharePoint 2010 is already on your box when you install Data Services, you will need an iisreset to make the Data Service Endpoint show-up.

And then to program against a Data Services enabled SharePoint box you need either:

Where is your Data Service Endpoint?

Assuming you’ve got everything setup and working the first thing you need to know is where your Data Service endpoint is installed.

If your SharePoint site is http://mflasko-dev/ (thanks Mike) then your Data Services endpoint will be http://mflasko-dev/_vti_bin/listdata.svc.

If you open one of these endpoints up in Internet Explorer you’ll see something like this:


As you can see this is a standard Data Services Atom feed, listing all the Lists on the SharePoint site.


Once you know where your Data Service is located, the next step is to write your Data Services Client application.

Create the Sharepoint Application:

But first to demonstrate how easy this is, I’ve used SharePoint to create the simplest of all Suggestion Tracking applications.

You can follow along by following these simple steps:

  1. Create a ‘Suggestions’ list which is based on an ‘Issues’ list.

  2. Finished!

The resulting list looks something like this:


The idea is that this list will capture all the suggestions users have for making a departmental line of business (LOB) application better.

But rather than making people go to the SharePoint site to make the suggestion, we want to allow the users to do it right in the LOB application.

Talking to Sharepoint using Data Services:

The first step as always to add a service reference, using the location of the Data Service that exposes SharePoint data (i.e. http://mflasko-dev/_vti_bin/listdata.svc)


Once you’ve done this you will have CLR classes representing the types in each list, and you will have a strongly typed DataServiceContext called TeamSiteDataContext that allows you to access the data:


Rather than focusing on how the user enters the suggest in your LOB application, lets focus on how to POST that suggestion to Sharepoint.

To do that you need to write a method something like this:

public void PostSuggestion(string title, string description)
   TeamSiteDataContext ctx = new TeamSiteDataContext(
        new Uri(
      new SuggestionsItem{
          Title = title, 
          Description = description

As you can see this is very easy.

In an environment like Silverlight it is a little more complicated because whenever you cross a network boundary have to deal with the Async and Threading issues. Which means you can’t use SaveChanges() directly.

You have to use the standard BeginXXX() and EndXXX() async pattern and you need to use the Dispatcher to ensure the results are marshaled back on the UI thread:

      (IAsyncResult result) => Dispatcher.BeginInvoke(
          () => ctx.EndSaveChanges(result)),

In future blog posts we will dig into this in more detail, covering topic like Query / Update / Data Binding, Blob Handling and security policies over Sharepoint.

As always we are keen to hear your comments.

Alex James
Program Manager

Comments (12)

  1. BobS says:

    Are you sure that Sharepoint 2010 beta is available now on MSDN?

  2. dpblogs says:


    I made a mistake sorry. I just removed that comment.

    Sorry for the inconvenience.


  3. Nick says:

    Does this work against the current (private) SharePoint beta?

  4. Joerg says:


    Hi tried with SharePoint 2010 TAP+VS 2010 Beta2 and get a TypeLoadException:

    Could not load type ‘System.Data.Services.OpenTypes.LateBoundMethods’ from assembly ‘Microsoft.Data.Services, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089’.

    Using Reflector I see that OpenTypes.LateBoundMethods gets called in the link provider but is not available in the Microsoft.Data.Services assembly. Even Reflector cannot resolve and SharePoint failes too.

    Against what ADO.NET DS Version is SharePoint 2010 built and will the Beta coming in November will work against DS 1.5 CTP 2 (or whatever)?

    What can I do now to work with this to check out before next release?



    Running Win2008x64+SP2010+VS2010!

  5. Joerg says:


    btw, using http://<myserver>/_vti_bin/listdata.svc returns with an error showing the same TypeLoadException (cannot load assembly…the one already in the GAC – double checked it’s right version/token but seems to call wrong types).



  6. Alberto Diaz says:


    I have a answer about this article. I tried to insert a new task on a Tasks List and I found that I need to put a value on Created and Modified column. But this columns aren’t required fields, this columns are system fields.

    Why I had to write this value and cannot let it blank?

    If I let it blank, I had an exception telling that an error was encountered when parsing a DateTime value in the XML


    Alberto Diaz

  7. Ryan Morgan says:

    In the future, will other web services be exposed as well? Will we be able to manage users, get a simple of users, etc?

  8. varathi says:


    While adding the site as service reference(http://myserver/site/_vti_bin/listdata.svc) to my application,i got an exception. I have tried to connect this using Linqpad 4, Now also i' am getting exception. The exception is due to _1HistoryItem in this site. But i dont have any list or list items with this name. I found solution for this from one blog to load the csdl file in visual studio and to do something . But i was not able to succeed. Please help me on this.



  9. Hi,

    I'm using vs2010 professional..

    I need to know how to demonstrate about OData in vs2010.



  10. Damien says:

    We have just finished deploying SharePoint 2010 in our company,

    when i try to access a data service endpoint it simply times out (either through code or browser)

    the endpoint i am trying to his is http://SharePointServer/DmsViewer/_vti_bin/listdata.svc/ProductionLinks()

    if i then browse the list and retry the link it will then work but it seems that i need to browse the list with IE first (and maybe spin up the site)

    is there a way to make a data service call access a site without having to browse it first with IE?

  11. Clem says:

    Is it possible to change the site at runtime.  Since the service reference datacontext is the one for the site defined during development, you must develop using production only.  We are not permitted to develop using production data.  We need to develop against test data, move the app to production and change the url at runtime to point to the production list.  Can't really do this with SharePoint services since proxy's are not provided.

  12. irshad says:

    have any security problems when we install ADO.NET Data Services 1.5 in  SharePoint server?

Skip to main content