SharePoint 2010 Data Services – Part 2

1 ביולי 2010

תגיות: ,
6 תגובות

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:

DataServices_1

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.

DataServices_2

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.

הוסף תגובה
facebook linkedin twitter email

כתיבת תגובה

האימייל לא יוצג באתר. שדות החובה מסומנים *

6 תגובות

  1. Tony Yin12 ביולי 2010 ב 19:11

    Thanks for sharing this.

    In your opinion, what is the major difference between web service and data service? Both can be used to access SharePoint 2010 data from client. Client OM is another approach too.

    הגב
  2. Itay Shakury12 ביולי 2010 ב 22:08

    Hi Tony, Good question.
    If I recall correctly the asmx web services in 2010 are only for backward compatibility.
    Now, We are left with Data Services vs Client OM.
    I think it is better to choose Client OM whenever possible.
    If your application can't use client side code, OR your application is not one of [silverlight, .net, ECMA script], than Data Services is the one for you. Notice also that Data Services are for list items data only.

    Itay Shakury.

    הגב
  3. Spielen18 במרץ 2011 ב 17:58

    Still dont really get it… SharePoint is way too complicated imho

    הגב
  4. Jennica16 במאי 2011 ב 0:44

    Now we know who the senilsbe one is here. Great post!

    הגב
  5. choroshin5 בנובמבר 2011 ב 21:41

    Great post!!!

    הגב
  6. Amit17 במאי 2012 ב 7:48

    thanks, It helps me a lot about my doubts…

    הגב