LightSwitch working with SharePoint 2013 online data

30/10/2013

I’m doing some testing of the LightSwitch product that is shipped in a brand new version with Visual Studio 2013 for building data-centric apps. The good news is that LightSwitch no longer depend on Silverlight, but now supports HTML5 and jQuery for the client side rendering, which is a big plus in my book.

I was looking at some old videos from Beth Massi, to get up to speed with LightSwitch development, but couldn’t really get any connectivity to my SharePoint online instance and thus I wasn’t able to pull in data from my SharePoint lists.

It all looks pretty easy, just add a data source, select SharePoint list, and you would think you would be done. But before you can use SharePoint lists as a data source you have to enable SharePoint in your LightSwitch project. Otherwise you get the error: https://sjkpdev.onmicrosoft.com/_vti_bin/listdata.svc does not appear to be a valid site. SharePoint 2010 (or later) with an installation of WCF Data Services is required.. It’s not really logical to me why it’s not enabled when you try to add a SharePoint data source, even the help link at the Attach Data Source Wizard provides no useful information.

To enable SharePoint for your LightSwitch application you have to right click the base project in your solution and click Enable SharePoint…
enablesharepoint-lightswitch
That will bring up a dialog where you can enter your SharePoint url, and in case it is a SharePoint online instance it will also ask for authentication. After that have been done you will be able to add SharePoint lists as data sources. The location of “Enable SharePoint” have changed from the preview version of LightSwitch where it was under properties, which did help to confuse me when I was watching the old tutorial videos from Beth, which is why I decided to post this to hopefully help other in the same situation as me.