Create And Deploy Provider Hosted Add-In For SharePoint Online - Part Two

In the previous article, you saw how to create, configure and deploy remote add-in Web to Azure.

In this article, you will learn how to deploy the provider hosted app to SharePoint Online. From the solution structure, right click the App Manifest file of ‘OfficeProviderHostedAddIn’ and select View Code.

Hosted

This will show the page, where we can set the start page and the permission strings.

Hosted

Replace the start page with the URL of Azure Web app (https://officeproviderhostedadd-in.azurewebsites.net/), we had created in the first article. Ensure you add Https to the URL. Now, replace the ClientId value ‘*’ with the ClientId, which was created in the App Registration page in the previous article.

Hosted

Ensure https is added to the URL, else once we upload the package to the App Catalog, it might be shown as Invalid.

Hosted

Now, right click the addin and publish the addin.

Hosted

This will open up the addin publishing page. If the current profile has a Yellow highlighted exclamation mark, click Edit button.

Hosted

Make sure you have added the Client ID and Client Secret. Once they are filled up, Yellow exclamation warning will go off.

Hosted

Click on package to add-in.

Hosted

Enter the URL of Azure Web app we had created in the previous article and the client Id of the app.

previous

Make sure that https are used in the URL, else we will get the warning error, given below-

previous

On successful packaging, it will create the .app file in the local file system.

previous

Now, we have to upload the .app file to the app catalog of SharePoint Online. If an app catalog does not exist, you can check the article here to see how to create an app catalog. Once you are within the Apps Catalog, click Apps for SharePoint.

http://www.c-sharpcorner.com/article/sharepoint-online-app-catalog-in-office-365/

Click Upload and it will open up the file upload Window. Navigate to the app location and upload the .app file.

Navigate

The app file is now uploaded to the Apps Catalog.

Navigate

Now, we can add the recently uploaded app to the site by going to the site contents of the particular site. Click ‘From Your Organization’. This will show the recently uploaded app in the list. Click it.

Navigate

It will ask whether you trust the app. Click Trust it.

Navigate

This will start adding the provider hosted add-in to the site contents.

Navigate

Finally, it has been added to the list of apps present within the site.

Navigate

When we click on the app, it will go to the app redirect page and it will be navigated to the remote Azure Web app.

Navigate

As you can see in the Browser address bar, the redirection has been completed and Azure Web app has come up in the Browser. Here, we can see the current logged in user name, which was fetched, using controller and was displayed in the view of the MVC project. We can add more logic to MVC project, as per the requirement.

Navigate

Summary - Thus, we saw how to deploy a provider hosted add-in to SharePoint Online in Office 365, using Azure.

Up Next
    Ebook Download
    View all
    Learn
    View all