Tuesday, October 22, 2013

Creating a REST Connection

If you are using SharePoint 2010 after using designer 2007 for a couple years will soon try to create a data view using information from a list or library on a different site and find there is no option to add another library, and hence you can no longer add a library from another site in your data sources the way you used to. The good news is you still can. It's just done a different way. You can either use a SOAP connection or a REST Connection. While REST (Representational State Transfer) isn't new technology it is new to SharePoint and for those that want more information on it check out the wiki article here. In this post I'm going to show how to set up a simple REST Connection to use as a data source in a data view web part. Start by opening you site in SharePoint designer 2010 After your site, select Data Sources from the Navigation plane on the left hand side


Then select REST Service Connection from the Ribbon at the top



In the Data Source Properties select the Source tab. Enter the URL in the format http:/// _vti_bin/listdata.svc/ where is the host header of the site you are accessing, you will need to add // if you are connecting to a site not at the root (ie your url would become header>//_vti_bin/listsdata.svc/ _vti_bin/listdata.svc is the location of the server side scripts to read the list information is the name of the list you are accessing. Couple of things to note here: 1.To get the iURL of the list http:/_ vti_bin/listdata.svc into a browser and that will return all of the lists and libraries on that site. You can get all of the information you need from here. 2.The list name is case sensitive and will not work if you have incorrect case.



Depending on your set up you may also need to configure the permissions in the Permissions tab. If you don't set up permissions you may get an error when you try to use the data connection. If you see the error check your permissions tab This will now add the data sources to your available data sources and you'll be able to create data views with information from different sites just like you used to in Designer 2007. So far I have come across a couple of limitations. Mostly around lookup lists and the way the inforamtion is stored, for example the only information is the ID of the item that is being looked up therefore you can't display the title of that item in your dataview.

No comments:

Post a Comment