When we create a new app in Visual Studio, we are given the option to select an hosting model:
So, a quick introduction of the different hosting options. It is really based on your requirements which one you should / need to choose.
SharePoint-hosted App
Start with the simplest option: SharePoint-hosted apps, or apps where all components are hosted on either an on-premises or Office 365 SharePoint farm. SharePoint-hosted apps are installed on a SharePoint 2013 website, called the host web. They have their resources hosted on an isolated subsite of a host web, called the app web. It’s important to know the difference between host webs and app webs.
Get these benefits
|
But consider this
|
Reuse common SharePoint items, like lists and Web Parts.
|
You can use only JavaScript in the add-in—you can’t use any server-side code.
|
Relatively easy to create and deploy, so they are good for small team productivity add-ins and business process automation, with lower complexity business rules.
|
Your add-in has only the authorization privileges of the signed-in user.
|
Provider-hosted App
Provider-hosted apps for SharePoint include components that are deployed and hosted outside the SharePoint farm. They are installed to the host web, but their remote components are hosted on another server.
Get these benefits
|
But consider this
|
Host the add-in on Microsoft Azure or any remote web platform, including non-Microsoft platforms.
|
You are responsible for creating the installation, upgrade, and uninstallation logic of the remote components.
|
Use one of the SharePoint client object models, the JavaScript cross-domain library, or the SharePoint 2013 REST/OData-based web service to interact with SharePoint.
|
Each way of interacting with SharePoint has corresponding options for approaches to data access.
|
Gain authorization to SharePoint data using one of the three authorization systems.
|
You need to decide between OAuth and the cross-domain library to authorize your add-in’s access to SharePoint.
|
Deciding on a hosting pattern. You can use the following table to help sort out which hosting pattern best fits your needs.
Your requirements
|
Recommended Hosting pattern
|
Example
|
Work with and provision new SharePoint entities exclusively
|
SharePoint-hosted
|
An add-in that includes a people picker control and that stores information about SharePoint users in a SharePoint list
|
Use existing SharePoint entities and interact with external (non-SharePoint) web services
|
Provider-hosted
|
An add-in that gets customer addresses from an existing SharePoint list in the host web and uses a mapping service in a web application to display their locations
|
Provision new SharePoint entities and interact with external web services
|
Combined SharePoint-hosted and provider-hosted
|
A mapping add-in that provisions a SharePoint list on the appweb so that it can store latitude and longitude coordinates for addresses that are supplied by the user or pulled from an existing SharePoint list
|