Get Started Building SharePoint Apps in Minutes with LightSwitch
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: https://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.”
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)
If you’ve got questions and/or feedback, please head over to the LightSwitch Forum and let the team know.
More Resources & Reading
- HTML Client Resources Page
- LightSwitch Forum
- A New API for LightSwitch Server Interaction: The ServerApplicationContext
Enjoy!
Comments
Anonymous
January 17, 2013
Thanks again for this.Anonymous
January 17, 2013
Good post, thanks!!!Anonymous
January 18, 2013
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,--rjAnonymous
January 20, 2013
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?Anonymous
January 21, 2013
@TheDeez -- On premise SharePoint 2013 will be supported with the final release. It's not available with the Preview 2 release.Anonymous
January 22, 2013
Good Post!!Anonymous
January 22, 2013
The color schemes are so unattractive... I wish MSFT had a better design & colorAnonymous
January 22, 2013
Thanks Beth! SharePoint Developers need to see more of this.Anonymous
January 31, 2013
@ChrisL - See this post on how to quickly create your own theme: blogs.msdn.com/.../theming-a-lightswitch-sharepoint-app-with-themeroller.aspxAnonymous
January 31, 2013
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?Anonymous
February 01, 2013
The comment has been removedAnonymous
March 07, 2013
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 MarstonAnonymous
March 11, 2013
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.aspxIf 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/.../threadsThanks!-BethAnonymous
March 12, 2013
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.Anonymous
March 14, 2013
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?Anonymous
March 16, 2013
This is great application I am using, now I am a fan of light switchThanks,Browse couldwww.sqlservermanagementstudio.net/.../microsoft-sql-azure.htmlAnonymous
March 16, 2013
Got it working. Very nice app. Thanks for your help, Beth (and Chris Rummel on the forums with my WCF issue)Anonymous
August 08, 2013
Tutorial does not say how to run it and zip file link is broken. No binaries included in download either. Projedt will not build. Not a good show guys!code.msdn.microsoft.com/.../LightSwitchSurveyApplicationTutorial.zipAnonymous
August 13, 2013
Hi Laurence,The ZIP link on the sample works for me. Here's the direct link: code.msdn.microsoft.com/.../LightSwitchSurveyApplicationTutorial.zipNo there are no binaries. The walkthrough is meant to be completed by you on your own Office 365/SharePoint site. Once you complete the walkthrough then you will have a deployable project.Cheers,-BethAnonymous
June 03, 2015
Good postAnonymous
August 19, 2016
Its tremendous :)Anonymous
August 26, 2016
TremendousAnonymous
September 04, 2016
Its splendid :)