Ramon Torras

TECHNOLOGY ENTHUSIAST

How to publish our provider hosted app on SharePoint Online

Requirements:

 

Prepare your Visual Studio Solution

First of all, open the SharePoint app solution in your visual Studio. In the solution you will have almost two projects. A SharePoint project for the SharePoint side and a web project for the Remote web.

You will need to create a profile for the remote web in order to deploy to an existing IIS. In my case I published it on azure IIS but you can do the same with your local IIS.

Once you have that, you can publish the remote web.

 

Inside the remote web you should check:

The web.config file

There are two keys that you should have inside <Appsettings> tag:

  • ClientId
  • ClientSecret

You have to keep these values because you will use them in order to link with the app in the SharePoint side. I usually copy them to a notepad window.

 

 

Now click right button over the SharePoint Project and select Publish.

 

 

Here you will see that you have to complete the deployment profile. Click on Edit.

 

At this point, you have to introduce the SAME values that you had in the web.config

 

Now we are ready to build the app. Click on “package the app”.

Here you have to introduce the same Client ID that you had on the web.config and click Finish.

Now an explorer windows will be opened. Where you can localize the <app name>.app. This file will be uploaded to SharePoint online manually.

Register the app

Now let’s open a browser and let’s go to the SharePoint online site. We can upload the app to the app catalog but in development period is easier register the app manually.

Before upload the app to SharePoint online. You need to register the app using this page:

https://<your SharePoint online URL>/_layouts/appregnew.aspx

 

Once you register the app (creates internally a registration inside SharePoint) now you will be able to add the app to your site.

 

 

 

You should trust the app clicking “Trust it” button and after few seconds your app will be installed in your SP web.

 

 

Now if click on the app you will be redirected to your remote web.

In my case is iocsampleapp.azurewebsites.net but in your case would be a dedicated web server.