Académique Documents
Professionnel Documents
Culture Documents
"Apps" is not just a marketing strategy to increase use of SharePoint, but also a replacement to the
sandbox approach with many advantages for both Development and Configuration. Sandbox Solutions
are introduced in SharePoint 2010 and now they are deprecated, to force/encourage the usage of Apps.
Custom code will not be executed on server. So this can avoid, Application / Server outages.
Custom code will be executed in Client-Browser or may be in some other scope like IIS or
Windows Azure, which is completely out of SharePoint scope.
Server Object Model (SOM) code is replaced by Client side object model (CSOM) / Rest Services
using which Apps can communicate with Server.
Authentication is done by “OAuth”.
Installing / Updating / Uninstalling of apps can be done without affecting the SharePoint site.
Better usability in Tablets and Mobile devices.
Taking SharePoint to next level in terms of Usability, Development, Deployment and Hosting
(cloud).
Finally, everything in SharePoint 2013 is an App.
There was another option to create an APP “Auto-hosted”, but this has been recently ruled out by
Microsoft.
Building a Provider hosted APP using MVC hosted on O365 with Azure.
Hybrid model – Fetch data from On-Premise SQL using Entity Framework and display it on a
Provider hosted APP.
This has been divided into two steps so that we understand them better with screenshot from actual
demo example.
LET US BEGIN.
Step By Step creation of Provider Hosted App hosted on O365 (SharePoint online) with Azure
The following steps are required for creating a provider hosted App
Step 1 - Create O365 Tenant – You can skip this step if you already have a tenant created.
Step 2 - SharePoint Online Developer Site - You can skip this step if you already have a
developer site created.
Step 3 - Install Visual Studios - You can skip this step if you already have a Visual Studio 2013
with Office Tools.
Step 4 - Create Provider Hosted APP Project in VS2013.
Step 5 - Create Azure Web APP and download the publishing profile.
Step 6 - Create Client ID and Client Secret.
Step 7 - Use Client ID and Client Secret created in the step above in the VS 2013 project.
Step 8 - Permissions for the APP
Step 9 - Build and package the APP
Step 10 - Upload and Publish the APP
https://portal.office.com/admin : This link gives you the dashboard view of all the required
services.
Once your developer site is opened, copy the URL. We will be using this URL for the
developmentpurpose. Refer the screen shot below:
Select the Template App for SharePoint 2013. Name the Project as SampleProviderApp. As
shown in the screenshot below
Select “ASP.NET MVC Web Application” and click “Next”. As shown in the screenshot below
To create a Web APP, click on the “WEB APPS” option. On the bottom of the page you will see
the option to add a “NEW” Web App. As shown in the screenshot below:
Have created a Website with name “SampleProviderApp”. You can create a web site with any
name. As shown in the screenshot below.
Click on the “Dashboard” tab, and on the “Quick Glance” section click on “Download Publishing
Profile”. As shown in the screenshot below:
Save this file for future use. As shown in the screenshot below.
Click on Generate Button for creating the Client ID and Client Secret. Enter the value as
described below:
Client ID: To be used in “Web.Config” of MVC Project and “App.Manifest” of Provider hosted
App Project.
Client Secret: To be used in “Web.Config” of MVC Project and “App.Manifest” of Provider
hosted App Project.
Title: Add the Title to the Application. E.g. (use project name).
E.g.
App Domain: sampleproviderapp.azurewebsites.net
Redirect URL: https://sampleproviderapp.azurewebsites.net
Click “Create” button and the following successful creation will show on the result page As
shown in the screenshot below (Do not close the page):
Once the Client ID and Client Secret is created follow the steps below:
Open the App.Menifest.xml file. To open this Right Click on the file and select Open Code. Please
see the screen shot below for reference:
Replace the Client ID generate in Step 6 and update the start page URL. As shown in the screenshot
below:
To grant permission for the App, double click on the “App.menifest.xml” file and select the
permission TAB. As shown in the screenshot below
Select Read Permission for the WEB. Please see the screen shot below for reference:
After deployment the first thing to do is publish your APP in Azure. Please follow the steps below:
Import the publishing-profile created in Step 5 and click Import. The Publishing profile will open
as shown below:
The site will open with Error, this is expected since it require SharePoint Context to run. As
shown in the screenshot below
Re-Build the Project and Publish the Project again. The following screen will open with the
default MVC.
Right click on the APP Project and select Publish. Please see the screenshot below for reference:
Enter the Client ID and Client Secret created in Step 6 and Click Finish. As shown in the
screenshot below:
Enter the Client ID and the URL. As shown in the screenshot below:
Click on “New App to Deploy”. Please see the screen shot for more details:
Click on upload on the popup. Please see the screen shot for more details:
On the Pop up window click on “Publish” button to publish the changes As shown in the screenshot
below:
Enter the credentials on the O365 login page. Please see the screen shot below for reference: