SharePoint-Hosted App Provision an isolated sub web on a parent web (separate domain) Reuse web...

27

Transcript of SharePoint-Hosted App Provision an isolated sub web on a parent web (separate domain) Reuse web...

Building Autohosted Apps for SharePoint 2013Richard diZerega Nathan MillerMTC Architect SharePoint TSP

SPC029

AssumptionsBasic knowledge of apps for SharePoint 2013Several previous sessions have illustrated the basics of app for SharePoint, so we assume you have basic understanding of Office 365, strategy behind apps, types of apps, OAuth with SharePoint 2013, 2013 API enhancements, and app tooling in Visual Studio

You are comfortable with 300-level topics and codeThis is a 300-level development session and we WILL spend considerable time in Visual Studio and reviewing technical topics/code relevant to autohosted apps

Evolution of SharePoint Development2007

SharePoint

IIS

Code runs from GAC on same w3wp.exe as

SharePoint web application

2010

SharePoint

IIS Sandbox

Code runs on SPUCWorkerProcess.ex

e or calls client.svc (CSOM)

2013

SharePoint

IIS with _api App

Code runs outside of SharePoint but has trust to

leverage capabilities exposed in _api

App Hosting Options

SharePoint-Hosted App

Provision an isolated sub web on a parent web (separate domain)• Reuse web elements

(lists, files, out-of-box web parts)• No server code allowed; use client JavaScript for logic, UX

Provider-Hosted App

“Bring your own server hosting infrastructure and technology platform”Get remote events

from SharePoint Use CSOM/REST + OAuth to work with SP

Cloud-based Apps

Your Hosted

Site

Autohosted App

Windows Azure + SQL Azure provisioned invisibly as apps are installed

Azure

SharePoint

Host WebApp Web*

(separate SharePoint domain)

SharePoint

Host WebApp Web*

(separate SharePoint domain)

SharePoint

Host WebApp Web

(separate SharePoint domain)

*App Webs are optional in Cloud-Hosted Apps

SharePoint Cloud

Host Web App Web Azure

Lists/LibrariesClient Web PartCustom ActionsManaged CodeModulesWeb Part PageDatabase

Autohosted Capability Quiz

Workflow

App Lifecycle

App Developer Tenant Admin

Site Owner

Site Owner

Site Owner

Site OwnerApp

Catalog

SharePoint Store

(Office Marketplace)

Tenant A

Tenant B

.app .app

.app

Web Site SQL DB

Workflow

Web Site SQL DB

Workflow

Web Site SQL DB

Workflow

Web Site SQL DB

Workflow

Demo

Autohosted App Debug vs. Deploy

App UX OptionsFull-ScreenNavigating to the app takes the user out of the SharePoint site and to the app host (ex: Azure, separate SharePoint domain, etc)The app uses the full real estate of the browser viewing area (can leverage SharePoint chrome)

SharePoint DialogSimilar to Full-screen, but displayed in a dialog windowTypically launched through custom action or script (ex: context menu or ribbon button)

App PartsDisplays app as an element in an existing web part or wiki pageVery similar to Page Viewer Web Part, but with better communication capabilities

Optimizing UXLeverage chrome controlChrome control allows full-screen apps to be framed in the chrome and styles similar to the host web (including placeholders for icons, breadcrumbs, and menus)

Import styles from host webAdd reference to http://<host web domain>/_layouts/15/defaultcss.ashx in the head of app pageThe chrome control automatically adds styles from the host web, so this approach is only required for pages displayed in app parts or modal windows

Optimize apps part size with post messageHost web listens for post message and resizes based on dimensions passed from the app partStill imperative to design around a predictable rendering size (challenging without knowing the styles that will be applied)

App PermissionsApp permissions are configured in the app manifestDevelopers specify the permissions the app needs to be able to run

Apps request permissions during installationGranting app permission is all or nothing (installer can’t pick a chose what to grant from the request)

Apps must be granted permissions by the user executing the appUsers can only grant the permissions they have

Azure Access Control Service (ACS) plays the role of the authorization serverAzure ACS stores basic information about the app and provides apps access tokens for calling SharePoint APIs

Facebook vs. SharePoint App Permissions

AppManifest.xml DissectedGeneral InformationTitle, version, icon, start page and query string

PermissionsPermission levels at specific scopes (ex: write access to profiles, read access to site collection)

PrerequisitesDefine feature dependencies for the app (ex: publishing features)

Supported LocalesDefines locales the application will support (ex: en-US, fr-FR, etc)

Remote EndpointsA list of remote endpoints the SharePoint App may access through SP.WebProxy.invoke()

App Storage OptionsSharePoint ListsGreat for SharePoint-hosted apps, but requires CAMLRequires an app web

SQL AzurePackage app with SQL Package (.dacpac) or by referencing SQL Database projectSQL Azure components are provisioned invisibly when the app is installed by a tenantConnection information in available through specific APIs (both SqlConnection class and raw connection string)

Others, but be careful with latency

SQL AzureUsing SqlConnection objectSpecify connection string in web.config using name LocalDBInstanceForDebugging and the API will dynamically use this connection when debugging

Using raw connection stringThe API for retrieving the raw connection string will NOT automatically work when debugging

Demo

Movember

App Roles/AdminsLeverage SharePoint permissions from app webThe app web inherits permissions from the host webGreat for simple permissions models (ex: App Administrator = Host Site Administrator)Be careful…checking permission on the host web would require the app to have full control of the host web

Store app permissions in the app’s storage (ex: SQL Azure)Very flexible…can use almost any data/permission modelNeed a way to seed the permissions table with administrators

Demo - Employee Recognition Part 1RequirementsAllow users to send recognition to other usersSubmission should post to the SharePoint NewsfeedApp should be profile aware (user pictures, titles, managers, etc)App should send email to submitter, recipient, and both managers (if applicable)No administrative settings (static settings)

Design DecisionsHosting: AutohostedUX: full-screen and app partAPIs: mixture of CSOM and SSOMStorage: SharePoint ListApp Roles/Admin: Not Applicable

Demo - Employee Recognition Part 2Requirements (same as previous, except the following)Allow users to select badges to go with the recognition (ex: Going Green, Community Ninja, etc)Allow app administrators to configure quotas and notification settingsProvide reports of recognition history

Design DecisionsHosting: AutohostedUX: full-screen and app partAPIs: mixture of CSOM and SSOMStorage: SQL Azure (much better for reporting) for data and SharePoint Library for badgesApp Roles/Admin: User permissions from SharePoint app web

Demo

Advanced Employee Recognition

Usage Model and LicensingMicrosoft-owned Azure accountAll autohosted apps for SharePoint are provisioned into a Microsoft-owned Azure account that only Microsoft has access to

Licensing through TenantAzure hosting costs passed through to tenant…developer doesn’t pay for hosting

App CatalogGreat for company-specific customizations1 app hosting license = 1 user / app / monthInitial number of free licenses, but more available for purchase by tenant admins

SharePoint StoreGreat for ISVs or developers looking capitalize on the app modelSupport for autohosted apps is coming soon to the SharePoint store

Usage Quotas/Throttling

Usage Quota 1 User 25 Users 250+ UsersCPU Time (Daily)

25 min / day 100 min / day 200 min / day

CPU Time (5min)

2 min / 5 min 7 min / 5 min 13 min / 5 min

Data Out 132MB / day 732MB / day 1533MB / dayStorage 1GB 1GB 1GBMemory Usage

640MB 640MB 640MB*Usage quotas can be monitored from SharePoint Online admin portal

Key TakeawaysEasy to DevelopDeveloping autohosted apps leverages familiar tools, simple deployment, and automatic DR

Simplified UpgradeAutohosted apps provide a reliable upgrade path and do not impede farm upgrades/patches

Cloud ReadyAutohosted apps were developed to provide an uncompromised cloud experience in Office 365

Rich SharePoint IntegrationNew APIs allow autohosted apps to run from Azure but richly integrate with SharePoint

Low Cost of Entry for DevelopersNo more bulky development environment…Visual Studio and a tenant

Code SamplesMovember App for SharePointhttp://sdrv.ms/ZCGLvnKudos Employee Recognition App (Basic)http://sdrv.ms/X3KbJQKudos Employee Recognition App (Advanced)http://sdrv.ms/QEfdFq

Evaluate this session now on MySPC using your laptop or mobile device: http://myspc.sharepointconference.com

MySPC

Questions?

© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.