SP2010: REST Data Sources within SharePoint Designer
With SharePoint 2010, there are multiple methods of getting data from a list. There’s the object model (client / server side), there’s webservices and there’s REST (which is kind of a webservice itself). With REST, you’re able to get data out of a list and view it on other sites. Those other sites don’t need to be in the same site collection or even farm, since it’s just XML data; you can get it from anywhere as long as you’ve got the correct credentials.
Here’s the steps to add list content to a page on another site:
1) Fire up SharePoint Designer and open up the site in which you want to add the content from another list
2) Click on “Data Sources” in the “Site Objects” menu on the left.
3) Choose new “REST Service connection”
4) Enter the URL to the list REST service. That’s always in the following format: http://web.site.com/sub/site/_vti_bin/ListData.svc/ListName. Replace web.site.com with the actual URL of your site, and ListName with the name of your list.
5) Check the Login tab and set the proper login method. I had some problems with the Windows Authentication, not quite sure why. Entering the login details and saving them with the connection fixed it, but that’s probably not best practice since your usename and password will be stored in clean text.
6) Press OK to save the new data source
7) Open up the page on which you want to view the data
8) Click the Insert tab on the ribbon, choose “Data View” and select your newly created data source.
And there it is! Your data should now display. The DataView is a powerfull webpart which i haven’t explored fully yet, but it promises to have great options for displaying data in various ways on your site. Combined with the REST services, you can now get virtually any data from any SharePoint site and display it where you like, how you like it. Enjoy!
June 7, 2016 at 7:02 am |
this is to display data from sharepoint list itself?then why to create data source this way..list can be directly added as a datasource ,right?
June 7, 2016 at 7:18 am |
Hi Nikita, you can add a list directly, but only when that list resides on the same site. If the list is in a different site (collection), you cannot add it in SharePoint Designer and so you will need to use the REST API. I’m not sure whether I can help you on your problem, it’s been a while since I touched SharePoint 2010, but if you share more detail I can try.
June 8, 2016 at 1:54 pm |
hey,thanks for replying.
currently i am working with 2013. We have one external link which is built using rest services. basically its a data from SAP. and we need to consume that in sharepoint. so i created a data source as described in this post ..rest service connection. but when i add that data source to a page I get this below error,
The server returned a non specific error while trying to get data from data source. check the format and content of your query and try again.
Also this external link which i m trying to configure here in data source is accesible over browser.
June 8, 2016 at 3:05 pm |
So you get the error in SharePoint Designer, right? You might want to try installing Fiddler to see what traffic is going over the line. I’m guessing it might be related to your REST endpoint having some kind of (network) security restrictions. With Fiddler you should be able to see whether the service is actually returning (correct) data.
June 7, 2016 at 7:05 am |
i have a external rest url… i created a datasource of it. but while adding it ,m getting some error
October 5, 2016 at 2:36 pm |
is possible to use this also for external Rest API?
I connected external REST API, but when I insert it as “Data source” nothing show on page. If I insert this Rest as “Data View” designer window just blink and nothing happen, no code is added.
Can you give me some clue what can cause this?
October 5, 2016 at 3:23 pm |
Whether the REST API is internal or external should not make a difference. The SharePoint Server and the machine where you are running SharePoint Designer need to be able to connect to the endpoint for this to work. Also, check for any authentication requirements that your REST endpoint might have. I would advise to install Fiddler on the box where you are running SharePoint Designer and monitor what’s going on behind the scene’s. That might give you more information on what is wrong.
October 10, 2016 at 11:30 am |
thank you for reply. Unfortunately my REST have oauth so I think it is not possible to connect it without adding this authorisation proceeding to ShP (I thnik this is for deeper programming). Or is there some other way for oauth?
October 10, 2016 at 11:54 am |
Hi Ivan, I’m pretty sure that OAuth won’t work indeed. If you do not have an option to change the data source authentication, you could create a relay service that handles the authentication and itself implements Windows authentication. This would require some kind of implicit flow to be able to authenticate without a user entering credentials. Of course that introduces other challenges and I haven’t done that personally, but it might be a viable workaround for you.