Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I've been researching for a way to add a list from another site to a Data View in SP Designer 2010. After confirming that the easy way (adding the list directly as a data source) was eliminated from SP2010, I tried to create a REST data source to the list.

The problem I have is that despite trying to add a REST datasource (using "http://intranet.com/site/subsite/_vti_bin/listdata.svc/Name of List/") the data source won't work. First I tried without authenticating, then using windows auth and finally with the Admin's username and password and in all three cases, the connection failed.

What could I be doing wrong? Is there a configuration somewhere to allow a REST connections? Or is there a way to use SOAP to connect to the list?

share|improve this question
    
Can you put the URL directly in the browser and get results for the list? Are you developing locally on the SharePoint Server or connecting with SPD remotely? –  Chris Beckett Aug 26 '11 at 5:56
    
I'm connecting to a SP Server in another computer. And what I see in the browser is: <error xmlns="schemas.microsoft.com/ado/2007/08/dataservices/…; <code/> <message xml:lang="en-US"> Resource not found for the segment 'Name of List'. </message> </error> –  Carlos G. Aug 27 '11 at 6:46
    
Try invoking the web service as just /_vti_bin/listdata.svc. If you reference the service without a list name, it should show you a feed result with the names of all the lists available on the site. No, there is no way to turn on or off the ListData service, it should work (if you have applied the ADO.NET 3.5 Update to the RTM install). –  Chris Beckett Aug 27 '11 at 16:39
    
@Chris When I try that, I get a list with a bunch of collections, including the one I'm trying to read –  Carlos G. Aug 27 '11 at 17:52
    
Well, that is good news. I suspect the problem is how you are forming the full URL with the list name, which is what the error message you are getting might suggest. Is there a space in the list name? –  Chris Beckett Aug 28 '11 at 5:56
show 1 more comment

1 Answer 1

As Chris has made as a suggestion - /_vti_bin/listdata.svc - This web service can be used to retreive a single list in a REST-ful URL method.

/_vti_bin/listdata.svc/NameOfList - you can get ID values in the same way by appending a specific value to the URL and the example ID being 5.

/_vti_bin/listdata.svc/NameOfList(5)

The result set will be returned as XML and using the query string (URL), again you can manipulate the List as this invokes the CAML, which is returning the list data. This was you can get to filters and CAML statements such as order by.

/_vti_bin/listdata.svc/NameOfList?$filter=PersonTitle eq 'Doctor' or /_vti_bin/listdata.svc/NameOfList?$orderby=PersonTitle desc

Once you have the basic concept working from you list, you can put it all together and do things like;

intranet.com/site/subsite/_vti_bin/listdata.svc/NameOfList()?$filter=ID gt 100&$orderby=PersonTitle&$select=FirstName,LastName,EMailAddress,SomeOtherField

Data Connection Types

Linked Data Source-allows you to connect data sources from different locations and show it in one Data View.

Database Connection – allows you to connect to databases.

SOAP Service Connection – allows you to connect to SOAP service connections (e.g. Web Service).

REST Service Connection – allows you to connect to REST service connections (e.g. RSS).

XML File connection- allows you to connect to any XML file of your choosing.

All of these are part of SharePoint Designer 2010. So all you need to do is, open SharePoint Designer 2010, enter "Data Sources" and click on "SOAP Service Connection".

From your example provided, the URL should be;

intranet.com/site/subsite/_vti_bin/lists.asmx?WSDL

SharePoint Web services are served from the following location on the server - %COMMONPROGRAMFILES%\Microsoft Shared\web server extensions\14\ISAPI - you can make references to this folder with Visual Studio 2010 if you plan on creating a code based solution, or you can use SharePoint Designer 2010.

Using SharePoint designer, you can mix jQuery into the equation and make use of JavaScript and the rich template features in jQuery. I like the fact that being client side technology, much of the load is removed from the server, which is a neat feature and allows for manipulating the document by transformations, without repeatedly posting to the server, round-tripping the same dataset.

The other benefit this has, javascript is very mobile friendly and it's easy to use a little bit of detection with CSS to set some values for formatting. AJAX loading, HTML5 features and all that can be added as you wish to the server folder;

\14\TEMPLATE\LAYOUTS

Simply place jQuery and any other libraries you plan to use, then call them in the ASPX as such;

By editing your v4.master and adding the script link so you have global JavaScript variables available as such (you may do the same for CSS Registration);

*note - Layouts is a localised folder - list of LCID's - http://msdn.microsoft.com/en-us/goglobal/bb964664.aspx - you may be required to add the 1033 folder and call accordingly (English). Additionally look into the - Defer="false" - setting will determine if the script is loaded before or after the page, or at the same time.

or use on a single page;

or a localised single page, with a custom folder;

or loaded from a content delivery network server (CDN);

http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">

So right now I guess you are wondering, why did he just ramble on about Java Script? Well as I said, I like the fact this is a client side way of working and this is one of the advantages of the way SharePoint has been designed. It takes the load off the server by using web services, which can then be called on the client as such.

var wsMethod = "UpdateListItems";
var soapNs = "http://schemas.microsoft.com/sharepoint/soap/";

var soapKiranu = new SOAPObject(wsMethod);
soapKiranu.ns = soapNs;
soapKiranu.appendChild(new SOAPObject("NameOfList")).val("list1");
soapKiranu.appendChild(new SOAPObject("updates")).val(batch);

var sr = new SOAPRequest(soapNs + wsMethod, soapKiranu);

SOAPClient.Proxy = "http://intranet.com/site/subsite/_vti_bin/lists.asmx";
SOAPClient.SendRequest(sr, processResponse);

Hope this is of some help. Happy coding!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.