2014 SharePoint Saturday Melbourne Apps or not to Apps

Preview:

DESCRIPTION

2014 SharePoint Saturday Melbourne Apps or not to Apps

Citation preview

Gold Sponsors Bronze SponsorsSilver Sponsors

SharePoint and Office 365 dev : to apps or not to apps (v3)

#SPSMEL

All is Apps, let’s go !!

SharePoint and Office 365 dev : to apps or not to apps : v1

#SPSMEL

… well ! It depends …

SharePoint and Office 365 dev : to apps or not to apps : v2

#SPSMEL

Where are we now ?

SharePoint and Office 365 dev : to apps or not to apps : v3

#SPSMEL

Who am I ?

Gilles PommierOffice 365 MVP, MCT and co-founder of SmartView http://www.smartview.frgilles.pommier@smartview.fr

SmartViewAgileSharePoint/Office 365Coaching/Training

Agile + SharePoint

Agenda

Apps model : all you need to knowComparison Apps vs. old WSPNew Wave of SharePoint Dev

Apps model : all you need to know

SharePoint 2013 : everything is an App !

Add an app to your SharePoint Site

Add an app to your SharePoint Site

Add an app to your SharePoint Site

Add an app to your SharePoint Site

Add an app to your SharePoint Site

Add an app to your SharePoint Site

Add an app to your SharePoint Site

Add an app to your SharePoint Site

Add an app to your SharePoint Site

Add an app to your SharePoint Site

App user experiences

Immersive full page app (aka SPA)At least one required in every app—landing page; can still use SharePoint chroming; lives in remote web for a cloud-hosted app

App PartLike a web part; hosted in an IFRAME (can point to content in remote web)

UI custom actions (declarative)

Evolution of SharePoint Development Solutions

2007

SharePoint

IIS

Code runs from GAC on same w3wp.exe as SharePoint web application

2010

SharePoint

IIS Sandbox

Code runs on SPUCWorkerProcess.exe or calls client.svc (CSOM)

-No code solution-

2013

SharePoint

IIS with _api App

Code runs outside of SharePoint but has trust to leverage capabilities exposed in _api

SharePoint2007

SharePoint2010

SharePoint 2013/Office 365

Services (IIS, Apache, Other, …)

Services (Azure, IIS, Apache, Other…)

Services(Azure, IIS, Apache,Other, etc…)

SP2007 SP2010 SP2013

Declar. App & Workflow Events

Custom Code

Custom Code

CSOM

_vti_bin_vti_bin

_api

_api

Evolution of customizations in SharePoint

But what has really changed !!??

Before/After

Developer Site

NapaµOffice 365 Development Tools

SharePoint-hosted App Provider-hosted App

Office 365 Development Environments

Visual StudioOffice Developer Tools

SharePoint Client Components

App isolation: App web vs Host web

Apps live in their own isolated environment called the “app web”.The site in which they function is called the “host web”

http://app-7b0fe2bced5247.apps.contoso.com/555DE569-4083-4397-8714-668B91D9C7A9

APP1UID GUIDAPP1

Get remote events from SharePointUse CSOM/REST + OAuth

Provider-hosted AppBring your own server hosting infrastructureAutohosted AppWindows Azure + SQL Azure provisioned automatically as apps are installed

SharePoint Web

Your Hosted Siteincluding Azure

SharePoint Web

Azure lite

SharePoint-Hosted AppReuse web elements (lists, out-of-box web parts). Client side technologies and declarative workflows. No server-side code.

Hostweb

App Web(from WSP)

Cloud-hosted Apps

SharePoint app hosting

Be careful …

Autohosted Apps Preview program has ended– 05/16/2014

http://blogs.office.com/2014/05/16/update-on-autohosted-apps-preview-program/

How apps run

SP Farm Other Platform

CSOM/OData

OAuth

Demo : Provider Hosted apps

Project structureMVC SharePoint TemplateAzure deployment

Accessing SharePoint data remotely

.NET Managed client object model (CSOM) JavaScript client object model (JSOM) REST endpoints with OData

.NET Managed client object model (CSOM) example

Differences between C# and JavaScript

C# JavaScript

using Microsoft.SharePoint.Client; ExecuteOrDelayUntilScriptLoaded(initFunc, “sp.js”); …or…$(document).ready(initFunc);

using (ClientContext context = new ClientContext(absoluteUrl))using (ClientContext context = TokenHelper…( ))

var context = SP.ClientContext.get_current();var context = new SP.ClientContext(relativeUrl);

string title = web.Title; var title = web.get_title();

context.Load(oList, list=>list.Title, list=>list.Created);

context.load(oList, ‘Title’, ‘Id’);context.load(oListColl, ‘Include(Title, Id)’);

context.ExecuteQuery();context.ExecuteQueryAsync();

context.executeQueryAsync(onSuccess, onError);

Value types: StringCollection Value types: string[], NaN

Automatic FormDigest handling Manual FormDigest handling

Issues creating RoleDefinitionBindingCollection’s

Comparison Apps vs. old WSP

Apps (.App) vs solution packages (WSP)

Apps Sandboxed WSP No Code (*)

Full trust WSP(on prem only)

Where does server-side code run? Anywhere but farm

Farm (User Code Service) Farm (w3wp.exe)

Scalable Highly Limited Based on farm

Who installs and removes Users Site collection admin Farm admin

Supported in SP2013 Yes Yes Yes

SharePoint Online compatible Yes Yes No

Azure-hosting compatible Yes No No

Requires local farm for developers No Yes Yes

Remote deployment and debugging from Visual Studio Yes No No

*SandBox Solution with code is deprecated in SP 2013 & O365

Why Apps?

When to use the new SP2013 App Model?When your SharePoint customizations use: Full screen interfaces (SPA) App Parts Workflows and Remote Event Receivers Data from other systems Custom Ribbon/Menu Actions Custom Lists/Fields/Views/etc Capabilities offered by your host of choice

When NOT to Use the New SP2013 App ModelJust some examples:

Web templates

Deploying assets to /_vti_bin or /_layouts

Connectable App Parts

Reusable workflow actions for farm

Reusable custom Web Services

Gray Areas

= Things that you can do in an app for SharePoint, but perhaps there are:

limitations or alternative ways to do it

Branding

Design ManagerFarm Solution

Sandboxed Solution

app for SharePoint

Recommendedto evaluate this!

All three of these are still traditional ways to change look and feel of SharePoint

SharePoint Designer

Maybe… through event receivers, PowerShell, and more

wsp

MSDN : how to deploy a custom theme, apps ?

Demo : Branding with Apps

• Branding with apps is possible (http://www.youtube.com/watch?v=wtQKjsjs55I)

• Need “full control” for the site collection (cannot be deployed on Office Store)

• Provisioning pages, layout, etc to site collection galery … must be done by CSOM

Timer Jobs

Not directly supported in an app for SharePoint

Alternatives: 1) New Windows Azure WebJob feature2) Console App3) Farm Solution (on premises only)

External data

BCS supports only OData connections in the App Model

Alternatives: 1) Create your own OData wrapper

outside of the app for SharePoint

2) Write code instead of using BCS

“To App or Not To App” ?

SharePoint 2013 (on prem) DOES support:

So why use the App Model?It is the recommended approach for development for SP2013 and beyond!

Farm Solutions compiled for SharePoint 2013

Sandbox Solutions compiled for SharePoint 2013

Farm Solutions compiled for SharePoint 2010

Sandbox Solutions compiled for SharePoint 2010

“To App or Not To App” (Decision Matrix)

1) Out of box SP capabilities?

2) App already exists?

3) Lite customization tools?

4) App Model? (with Azure,…)

5) Only as a last resort – farm/sandbox solution?

New Wave of SharePoint Dev

SharePoint 2013 / O365 developer = Web Developer

Before : Is there any SharePoint Developer available ?

Old WSP talksDid you check your code with

SPDisposeCheck Tool ??

SP 2013 dev talks now are more …

Angular JS ?Knockout JS ?

Breeze ?TypeScript ?

Demo :javascript – angular js – Office 365 API …

http://dev.office.com & http://officeams.codeplex.com

New SharePoint client components redistsUpdated client components for SharePoint server 2013 SP1New client components for SharePoint onlineBoth include portable libraries for use in Windows Store apps

New APIs available in Office 365 and on-premisesSite collection managementSpecify content type IDsAlternateCssUrlSiteLogoUrland More

Site provisioning and branding solution pack

New SharePoint remote APIs

Sample Site Collection management (RunWithElevatedPrivileges is back ? )

Further reading

Andrew Connell : My thoughts on the SharePoint App Model, Office 365, SharePoint Store and the Business of SharePoint Apps TodayDoug Ware : The SharePoint 2013 App Model is better than FarmBjørn Furuknap : SharePoint 2013 App Model – The Jury is BackJeremy Thake : Migrating Solution Packages to SharePoint 2013 Apps…really?Chris O'Brien : SP2013 host web apps: provisioning files (e.g. master pages) to the host web

Takeaway

Futur of development model for SharePoint and O365 is Apps

SharePoint developer is changing to become Web Developer (javascript/jquery/html)

Use apps whenever it’s possibleSome developement cannot be done with apps, but there are alternative solutions

YES, you can do AngularJS with SP Farm WebPartFarms & SandBox solutions are still used … for now

Gold Sponsors Bronze SponsorsSilver Sponsors

Thanks

Gold Sponsors Bronze SponsorsSilver Sponsors

Deployment

Model Office 365 Permissions On-Prem Permissions

SharePoint

Sandbox YES YES

Full Trust NO YES

SharePoint Hosted

YES OAuth via ACS YES High-Trust (S2S)

Remote

Provider Hosted• Developer

hosts app• Could be in

Azure

YES OAuth via ACS YES High-Trust (S2S)

Auto-Hosted• App can deploy

website and SQL Azure db

• Hosted in Office 365 Azure Cloud

YES OAuth via ACS NO

Compare customization models

Full trust WSP Sandboxed WSP Apps

Where does server-side code run? Farm (w3wp.exe) Farm (User Code

Service) Anywhere but farm

Scalable Based on farm Limited Highly

Who installs and removes Farm admin Site collection admin Users

Supported in SP2013 Yes Yes Yes

SharePoint Online compatible No Yes Yes

Auto-hosting compatible No No Yes

Requires local farm for developers Yes Yes No

Remote deployment and debugging from Visual Studio No No Yes

Hosting ComparisonSharePoint Hosted Cloud Hosted

App Scope SharePoint Site Site or Tenancy

Architecture Web Site Can be Multi-Tenant App

Developer Skillset SharePoint + HTML/JS

Full Stack

UI Technologies SharePoint + HTML/JS

Any Web Stack

Server Code None Any

Storage Lists and Libraries Any

Key Limitations No Server Code Hosting Expertise Required

Good for… Smaller apps & resource storage

Any type of Application