Skip to main content

Introduction to the REST interface in Sharepoint 2010

How to access SharePoint information using code that executes on the SharePoint server itself. The rest of this chapter focuses on methods of accessing SharePoint data from remote locations, whether that means accessing SharePoint using HTTP, a client application such as Silver light, or web service.

SharePoint 2010 provides a way of accessing list data using a Representational State Transfer (REST) interface. (Interfaces utilizing the REST interface are referred to as RESTful .) The RESTful interface provides a simple way for external applications to access and modify SharePoint data.

It makes it possible to retrieve an XML representation of list data by simply supplying a URL. It ’ s possible to carry out basic CRUD (create, read, update, and delete) operations using the REST interface, by using the HTTP operations of POST, GET, PUT, and DELETE. By passing in various parameters with your URLs, it ’ s possible to a filter and sort the data that you get back.

For your RESTful service to work, you must have installed the ADO.NET Data Services Update for .NET Framework 3.5 SP1.

You can supply ADO.NET Data Services with a SharePoint data source by passing it a RESTful URL from SharePoint. To learn more about this, read the article “ Query SharePoint Foundation with ADO.NET Data Services ” at http://msdn.microsoft.com/en - us/library/ee535480.aspx

To access the RESTful service, you ’ ll need to reference the following URL: /_vti_bin/ListData.svc.This URL should be appended to whichever site you are querying. For instance, if you want to retrieve list data from the accounting department ’ s site in your intranet, you would use a URL of http://intranet/sites/accounting/_vti_bin/ListData.svc.

You can see what kinds of results get returned by browsing to the list data service URL of the SharePoint site in your browser. If the results conform to an RSS standard, your browser may interpret the results as an RSS feed for you to subscribe to, which means it won ’ t display straight XML. When querying a particular list item, your browser might not be able to interpret the results as a feed and might give you an error.

You can get every list item out of a particular list in the site by appending the name of the list to the end of the URL. For example, to get all the documents from the Documents library in your accounting site, you would use a URL of:

http://intranet/sites/accounting/_vti_bin/ListData.svc/Documents

You can retrieve one particular list item from a list by passing in the ID of that list item after the list name, like this:

http://intranet/sites/accounting/_vti_bin/ListData.svc/Documents(2)

You can also find out the column value for one particular list item by passing the column name after the item number like this:

http://intranet/sites/accounting/_vti_bin/ListData.svc/Documents(2)/Title

You can sort your results by using the parameter $orderby and passing in the name of the column you would like to sort your results by. For instance, if you want to sort your documents by title, you would use a URL of:

http://intranet/sites/accounting/_vti_bin/ListData.svc/Documents?$orderby=Title

You can even execute a CAML query on your list by passing in a $filter parameter. For instance,
if you wanted to retrieve a document whose title was My Document, you could use a URL like:

http://intranet/sites/accounting/_vti_bin/ListData.svc/Documents?$filter=Title eq ‘ My Document ’

Although it ’ s unconventional to have spaces in your URL, it ’ s permitted when using the RESTful service. 
To read more about the RESTful service, visit the SDK article online:

http://msdn.microsoft.com/en - us/library/ff521587.aspx

Comments

  1. Yes! Finally someone writes about concepts.

    my website :: diet plan for women

    ReplyDelete

Post a Comment

Popular posts from this blog

Tab Control in Asp.Net

Scenerio: I need your help in designing tab control in   asp.net .My requirement is I need a tab control in   asp.net (C#) like  for example goto my computer ,right click c drive and select properties.we get tabs like general,security etc....... like that i need to design one tab control(no need of any rightclick) in my web page and the database table columns should come as tabs and inseide the tab data of that particular column should come.   Example:Employee master tab1:Employee name.........his name in the tab tab2:Age.............his age tab3:Address........his address   Solution:   You can do this using a simple div <style type="text/css"> .tabs         {             position: relative;             height: 20px;             margin: 0;   ...

AI and Microsoft: Revolutionizing Efficiency in Nonprofit Organizations

  How AI and Microsoft Enhance Efficiency in Nonprofit Organizations In today’s fast-paced world, nonprofit organizations face unique challenges—limited resources, increasing demands, and the constant need to do more with less. But what if technology could be the game-changer they need? In my latest research paper,  "How AI and Microsoft Enhance Efficiency in Nonprofit Organizations" , I explore how cutting-edge technologies like Artificial Intelligence (AI) and Microsoft’s innovative tools are revolutionizing the way nonprofits operate. From streamlining administrative tasks to enhancing donor engagement and optimizing resource allocation, AI and Microsoft’s solutions are empowering nonprofits to focus on what truly matters—their mission. This paper dives deep into real-world examples, practical applications, and the transformative potential of these technologies. Whether you’re a nonprofit professional, a tech enthusiast, or simply curious about the intersection of technolo...

Social tagging overview in Sharepoint 2010

A tag is a word or phrase that identifies an individual piece of information according to a set of attributes or criteria. Tags make it easy to find and share information about a specific subject or task. Social tagging helps users categorize information in ways that are meaningful to them. Social tagging can improve the quality of search results by filtering against specific tags, and it can also connect individuals who want to share information with other users who have like interests. This article describes the social tagging features in Microsoft SharePoint Server 2010. This article does not describe how to configure social tagging features. It also does not discuss how to implement social tagging features as part of an overall social media strategy for an enterprise. About using social tagging features Social tagging features help users to share information and to retrieve relevant, high-quality content more efficiently. Such sharing encourages collaboration and b...