You are here:   Blog
Register   |  Login


Apr 30

Written by: Michael Washington
4/30/2014 10:10 PM  RssIcon


You can deploy your LightSwitch applications to Office 365 / SharePoint Online.


The Cloud Business App project is normally used to create applications for Office 365 / SharePoint Online, however a Cloud Business App is simply a LightSwitch application that is already enabled to work with SharePoint. You can configure a normal LightSwitch application to work with SharePoint.

To perform this tutorial you must have Visual Studio 2013 with the Visual Studio 2013 Update 2 (or higher) installed.


We start with the application created in the tutorial: An End-To-End Visual Studio LightSwitch 2013 HTML5 Application.


We right-click on the project and select Enable SharePoint.


Next we enter the destination to our SharePoint site, or click the link to take us to the website that shows us where we can obtain a SharePoint developer site.


We will be required to log into our SharePoint developer website.


The Solution will be modified.

Note: There will be a backup of the project placed in a folder at: ..\Backup under the projects main folder in case you need to revert back.

Implement SharePoint User Management


The article: Using the Person Business Type covers the new Person business type enhancement to the LightSwitch / Cloud Business App project. It allows you to easily manage user related data in your application. In a LightSwitch application it will use Forms or Windows authentication. In a Cloud Business App application (or a LightSwitch application that has SharePoint enabled) it will use authentication controlled by SharePoint.


We simply change the type of the UserName property in the Order table from a simple String to the Person type.


Finally, we open the AddEditOrder screen and change the User Name control to use the Person Viewer.

Debug The Application


We run the application.


We log in.


When the screen opens and asks us to trust the application we select Trust it.


The application will work normally.

Close the web browser to stop debugging the application.

Deploy The Application


Before you can deploy an application, remove all testing instances of it by logging into your SharePoint development website, selecting Apps in Testing, and REMOVE.

Register The Application


Open the Application registration page using the following format:


Fill out the form as follows:

  1. Click the Generate button to create a Client Id
  2. Click the Generate button to create a Client Secret
  3. Enter a Title for your application
  4. Enter the App Domain that it will be hosted on (this is the base address without https)
  5. Enter the Redirect URI (this must use https and have SharepointLaunch.aspx at the end)
  6. Click the Create button


You will see a confirmation screen. You must copy these values down because you will need them for the Visual Studio Publishing wizard.


In Visual Studio, open the publishing wizard.


Select Provider-hosted for SharePoint Options.


For Security Setting you must set https to required.

Therefore you must host the site at a location that has a secure certificate so that https will work. You cannot use a IP address, you must use a domain name.


For SharePoint Client ID enter the values saved earlier.


On the Summary page, click Publish to deploy the application.

Note, you will not be able to log into the website unless you are calling it through the SharePoint website using a link that will be created in the next step.


The .app file will also be created (Visual Studio will open it up in a window), we can now upload it to our SharePoint site.

Installing the Application In SharePoint


Go into SharePoint administration.


Select the App Catalog.

(if you do not have one you will be prompted to create one and the you will have to return to the menu)


Select Distribute apps for SharePoint.


Select the .app file created earlier and upload it.


Enter additional details and click Save.


The application will show.


Go to Sites and create a new site or select an existing one.


Select the gear icon next to your name, and select Add an app.


Select From Your Organization, and then select the application we just added.


You will have to Trust it.


The app will install.


Now, when users log into the site and select Site Contents, they will be able to launch the application.


After you deploy, you may see a box that indicates a configuration needs to be fixed.

Select Fix it, then close your web browser and re-launch the application.

Links (Microsoft)

Guidelines for registering apps for SharePoint 2013

SharePoint Hosting & Authentication Options for LightSwitch (Brian Moore)

Publishing LightSwitch apps for SharePoint to the Catalog (Brian Moore)

How to: Publish a cloud business app to SharePoint

Visual Studio 2013 Update 2 

New Features

Using the Person Business Type

Integrating Documents in Cloud Business Apps

All About Newsfeeds With Your Cloud Business App (Nicole Haugen)


How Do I: Build and Deploy My First Cloud Business App on Office 365?

How Do I: Incorporate Document Libraries in a Cloud Business App?

How Do I: Use Newsfeeds to Socialize Data in a Cloud Business App?

LightSwitch Help Website Links

Creating A SharePoint Online Testing Site

Exploring SharePoint 2013 Visual Studio Cloud Business Apps (LightSwitch)

Creating A LightSwitch SharePoint 2013 Multi-Tenant Provider-Hosted Application

Implementing Documents in a SharePoint 2013 Cloud Business App (LightSwitch)

Embedding Your LightSwitch Cloud Business App Inside SharePoint As a App Part

Additional Links (Paul Van Bladel)

Deploying a provider hosted cloud business app

5 comment(s) so far...


Re: Deploy A LightSwitch Application To Office 365 / SharePoint Online


You did not complete after that, how can I add as a an APP?

Please help.

Thank you

By Musab Ghannaj on   5/5/2014 4:13 AM

Re: Deploy A LightSwitch Application To Office 365 / SharePoint Online

@Musab Ghannaj - please see the links at the end of the blog post

By Michael Washington on   5/5/2014 4:14 AM

Re: Deploy A LightSwitch Application To Office 365 / SharePoint Online (Provider Hosted)

Correct me if I'm wrong Michael, but even if you have an Office 365 Subscription, you need a special 'Developer' subscription, at extra cost, to deploy these Cloud Apps. If what I've said is true then what is the difference between SharePoint in Office 365 E3 say and SharePoint with a Developer subscription and why can't you deploy to standard SharePoint/Office 365?

Correct me if I'm wrong again but wouldn't I want to deploy this app to a real Office 365 subscription? If so why can't we enable the developer services that allow us to deploy our app to a standard Office 365 subscription?

Why are LightSwitch apps split now into 'LightSwitch web-Apps' and 'Cloud Business Apps'? just because you're deploying to a different platform? Is there a reason or is just going to degenerate into complete chaos again? I'm not smelling a plan that makes any sense any more.

By Lloyd on   5/25/2014 6:34 AM

Re: Deploy A LightSwitch Application To Office 365 / SharePoint Online (Provider Hosted)

@Lloyd - You can develop using a local SharePoint developer site. Setting this up was very difficult to me so it is not what I use. You can also deploy your SharePoint applications to your local SharePoint site and not use Office 365. Again, this is a difficult process and when I tried I spent hours trying to get the permissions properly configured that I gave up and just got a Office 365 subscription. But hey that's just me :)

As far as deploying to a "real" Office 365 site, I believe I cover that here:

As far as why there is now "LightSwitch" and "Cloud Business App" (there are just those two, a LightSwitch app that is SharePoint enabled is a 'Cloud Business App'), that is because to make a LightSwitch application run in SharePoint they have to make some non-trivial changes to the project.

By Michael Washington on   5/25/2014 7:12 AM

Re: Deploy A LightSwitch Application To Office 365 / SharePoint Online (Provider Hosted)

@Michael, We were in bug trouble to convert a Lightswitch auto hosted app to provider hosted one and had lot of issues and could not make it to work... Just followed these steps and created simple app and it worked fine...
With this experience , we resolved our app and it works like a charm. Thank you so much for your time and effort and it really helps people.

Please keep it up!

By Syed on   8/2/2014 10:22 AM

Your name:
Gravatar Preview
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Security Code
Enter the code shown above in the box below
Add Comment   Cancel 

Microsoft Visual Studio is a registered trademark of Microsoft Corporation / LightSwitch is a registered trademark of Microsoft Corporation