New Application Development model was introduced in SharePoint 2013 which allows the developers to extend the SharePoint platform. This post discusses the different hosting models available for the developers in SharePoint 2013. You need to understand the App Identity concept before knowing the details of Hosting Models.
App Identity in SharePoint 2013
Why do we need App Identity when there is a User Identity available in SharePoint 2010? Any custom code you wrote in previous version of SharePoint run under the context of the user. With full trust form solutions developer can elevate the privileges and get tasks done when the user was actually not authorized to do and Sandbox model for the developers is very restrictive.
App Identity in SharePoint 2013 provides an unique identity independent of the user. You can permission them separately from the user. When you install an App in SharePoint , you need to access to the site collection and user profile service and managed meta data fro the Taxonomy data service.
What is App Model?
The App Model was introduced in office and SharePoint 2013 to essentially have a low touch on SharePoint server by running custom code off the box. You either run custom code on client-side within the browser or on a remote web server. With App Model none of the custom code run on the SharePoint server, Still the support is there for Full trust and Sandbox solutions. With new App model you are decoupling the SharePoint and custom code.
SharePoint Hosted Apps are custom solutions that you build in which all the components of the solutions basically get provisioned into SharePoint or outside SharePoint. You can not write any server side code in this model. Only Client-side scripting is supported. The constraint is all the custom code needs to be written in java-script. Isolated web is created when you deploy the app in this model. SharePoint 2013 Client Side Object model support calling services using REST model and returns the response either in JSON or XML. Now you can call back-end services such as User Profiles, Search etc from client-side.
The above feature is available in all App Models. To develop Apps in SharePoint 2013 you need to download the development tool for Visual Studio 2012 from here. You can find the download link under tools section.
Create a new project in Visual Studio 2012 and App template under SharePoint from new project dialogue box as shown below
Provide a name for App and which site you want to debug locally and then select the App hosting model for the App.
Note: In SharePoint 2010 you needed to be on SharePoint box to develop SharePoint solutions. With 2013 you can effectively develop off the box. So basically develop on windows 8 machine and publish out to SharePoint site.
The solution structure of the application looks as below, It is setting up a solution structure which you can follow, You can see a default.aspx file under Pages folder.
Another important file in solution is AppManifest.xml which gets provisioned into the database and it tells the SharePoint what permissions that App needs other than providing some metadata like App name and App icon. Typical permission requests are shown in the below picture
In order to deploy the Apps you need to configure the environment for SharePoint 2013. The steps for configuration are
Step1: New Service Application Model has introduced in SharePoint 2013 is App Service Management Application. Make sure that App Management and SharePoint Foundation Subscription Settings services are running. Far hosting Apps requires Foundation Subscription Settings service running.
Step2 : Make sure that App Management Service and Setting Service Application service is created.
Step3: Once that is done click the new App node and Configure the App URLs
Step4: To get routed to the correct SharePoint server – You need to add DNS entry to your server. More information on this can be found here
In the next posts I can discuss about other Application Hosting Models.