Get Started Building SharePoint Apps in Minutes with LightSwitch

Get Started Building SharePoint Apps in Minutes with LightSwitch

Rate This
  • Comments 19

I’ve dabbled in SharePoint 2010 development in the past by using Visual Studio. In fact, I wrote a fair share of articles and samples about it. However I’ve been slacking when it comes to really learning the new app model in SharePoint 2013. I’ve got a good understanding of the architecture, have played with Napa a little, but I just haven’t really had the time to dig into the details, get dirty, and build some real SharePoint apps.

Luckily, one of my favorite products has come to save me! In the latest LightSwitch Preview, we have the ability to enable SharePoint 2013 on our LightSwitch projects. This gives us access to SharePoint assets as well as handling the deployment of our application into the SharePoint app catalog. In no time you can create a business app using the LightSwitch HTML client, deploy it to SharePoint 2013, and run it from a variety of mobile devices.

So why would you want to deploy a LightSwitch app to SharePoint? I mean, I can just host this app on my own or in Azure, right? Yes, you can still host LightSwitch apps yourself, however, enabling SharePoint in your LightSwitch apps allows you to take advantage of business data and processes that are already running in SharePoint in your enterprise. Many enterprises today use SharePoint as a portal of information and applications while using SharePoint’s security model to control access permissions. So with the new SharePoint 2013 apps model, this makes running LightSwitch applications from SharePoint / Office 365 very compelling for many businesses.

Sign Up for an Office 365 Developer Account

The easiest way to get started is to sign up for a free Office 365 Developer account. Head to dev.office.com to get started.  When you sign up, you’re required to supply a subdomain of .onmicrosoft.com and a user ID. After signup, you use the resulting user ID (i.e. userid@yourdomain.onmicrosoft.com) to sign in to your portal site where you administer your account. Your SharePoint 2013 Developer Site is provisioned at your new domain: http://yourdomain.onmicrosoft.com.

You can see your developer site by selecting SharePoint under the Admin menu on the top of the page. This will list all your site collections. Make sure you use this developer site for your LightSwitch apps otherwise when you debug your application you will get an error “Sideloading of apps is not enabled on this site.”

image

Get the LightSwitch HTML Client

In order to get LightSwitch SharePoint & HTML functionality, you’ll need to have Visual Studio 2012 Update 2 installed.

Install: Microsoft LightSwitch HTML Client for Visual Studio 2012

Build an App – Here’s a Tutorial

Now you’re ready to build an app! We’ve got a tutorial that walks you through building a survey application using LightSwitch that runs in SharePoint. I encourage you to give it a try, it should take under an hour to complete the tutorial, and in the end you’ll have a fully functional modern app that runs on a variety of mobile devices.

LightSwitch SharePoint Tutorial

This tutorial demonstrates how LightSwitch handles the authentication to SharePoint using OAuth for you. It also shows you how to use the SharePoint client object model from server code, as well as writing WebAPI methods that can be called from the HTML client. Check out my finished SharePoint app! (click images to enlarge)

image image image

If you’ve got questions and/or feedback, please head over to the LightSwitch Forum and let the team know.

More Resources & Reading

Enjoy!

Leave a Comment
  • Please add 7 and 4 and type the answer here:
  • Post
  • Thanks again for this.

  • Good post, thanks!!!

  • It’s important to note that the Office Store isn’t accepting SharePoint apps that use the autohosting model and has offered no timetable for when the embargo might be lifted.

    Cheers,

    --rj

  • Great article,

    Is it possible to host the current preview release of Lightswitch apps on Sharepoint 2013 on premise or only O365?  If On premise is not supported is this coming so that applications we currently develop could be converted to be hosted with our on premise Sharepoint 2013?

  • @TheDeez -- On premise SharePoint 2013 will be supported with the final release. It's not available with the Preview 2 release.

  • Good Post!!

  • The color schemes are so unattractive... I wish MSFT had a better design & color

  • Thanks Beth! SharePoint Developers need to see more of this.

  • @ChrisL - See this post on how to quickly create your own theme: blogs.msdn.com/.../theming-a-lightswitch-sharepoint-app-with-themeroller.aspx

  • If I want to do this for an on-prem application, do I still need the separate webserver to host the Lightswitch app, or can Sharepoint 2013 host the whole thing?

  • @SQLSophist - You need an IIS Server/Web Server to host the application still.  SharePoint can not host the whole thing for LightSwitch simply because there is a "Server" side component that can't be hosted in SharePoint.  If you are basically just interested in some basic HTML with no server back end that CAN be completely hosted in SharePoint then I know of 2 options -

    1) NAPA - msdn.microsoft.com/.../jj220038(v=office.15).aspx (this is O365 only)

    2) A "SharePoint Hosted" SharePoint VS Project - msdn.microsoft.com/.../jj220042(v=office.15).aspx

  • Beth, Thanks for this article and app. All was going smoothly -- created the initial app in VS 2012, published to O365. Connection confirmed, etc. Then, at Step 5.1, Attach to SharePoint Lists, from VS LS, got the following message: "...does not appear to be a valid site. SharePoint 2010 (or later) with an installation of WCF Data Services is required." I know it's a valid site, as it is O365 Developer site and I can connect to it in previous steps. I think it's an issue of using SP lists, but don't know. Any ideas? Thanks. Walt Marston

  • Walt, do you have the latest preview installed? We fixed some issues with list attach. You'll want VS Update 2 CTP4 - blogs.msdn.com/.../announcing-a-new-preview-of-the-lightswitch-html-client.aspx

    If you do, then please post the problem & repro steps in the forums and I'll get the team to take a look:

    social.msdn.microsoft.com/.../threads

    Thanks!

    -Beth

  • Thanks, Beth. I had not installed the latest preview, but now I have and the problem still persists. So, I will post to the forums as you suggest. Thanks.

  • I am getting a 403 Error when I click on the Customer or Product selection on the Add Survey screen.  No data shows up - but I get this error instead.  Any recommendations?

Page 1 of 2 (19 items) 12