Menu Home

LightSwitch working with SharePoint 2013 online data

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.

Categories: SharePoint

Tagged as:

Simon J.K. Pedersen

3 replies

  1. Good post Simon
    But I can find where to enable Sh.
    I have a VS2013 machine. ( in Win7 without SH) and other enviroment with VS2012 with SH instaled.
    Do you have any idea about that?

  2. The above screen shot is taken from a machine without SharePoint installed so that shouldn’t be a requirement. I have only tried with VS2013 premium, I don’t think lightswitch is available in e.g. the express version. Also remember that the project must be a lightswitch project even though it from the screenshot can look like a regular C# project. When it’s a lightswitch project you should be able to see the menu, when you right click on the first project in the solution (the project that doesn’t contain anything, except for the lightswitch configuration).

  3. I am using VS 2012 and SharePoint 2013. I have added a LightSwitch(HTML Application) Visual C#. In the properties, I enabled sharepoint and validated the URL. When i try to connect the external datasource, and selected sharepoint. specified the address. choose the “Automatically choose user identity”. Clicked Next -I am getting the error as “There was a problem accessing the web resource. Server returned error code: 500. An error occurred while processing this request..”
    I have also tried with “Use specified user credentials”, but the same error. How to fix this?
    Thanks

Leave a Reply

Your email address will not be published.