85
TRANSITIONING TO SHAREPOINT APP DEVELOPMENT Simon Rennocks Principal Consultant Microsoft Certified Master - SharePoint ProSource Solutions LLC

Transitioning to SharePoint App Development

Embed Size (px)

DESCRIPTION

Transitioning to SharePoint App Development

Citation preview

Page 1: Transitioning to SharePoint App Development

TRANSITIONING TO SHAREPOINT APP DEVELOPMENT

Simon Rennocks

Principal Consultant

Microsoft Certified Master - SharePoint

ProSource Solutions LLC

Page 2: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

SPEAKER BACKGROUND

Expertise

Principal Consultant

Microsoft Certified Master - SharePoint

ProSource Solutions LLC

18+ Years of Experience

Email [email protected]

Blog rennocks.wordpress.com

Twitter @simonrennocks

Page 3: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

SESSION GOALS

• Understand why apps will replace full trust code

• Know how to create an on premise development environment for building apps

• Be able to create SharePoint apps on premise and in Office 365

• Know how to publish apps both on premise and to Office 365

• Follow the best practices for developing updates for apps

Page 4: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

AGENDA

Building Apps

App Publishing

Updating Apps

Moving From Full Trust

Code

Getting Started with

Apps

Page 5: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

MOVING FROM FULL TRUST CODE

Page 6: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

CODE DIFFERENCES

Full Trust

Feature Receivers

Web Parts

Application Pages

Server-Side Code

Apps

App Event Receiver

App Parts

App Pages

Remote Server-side Code

Page 7: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

OPERATIONAL COMPARSION

Full Trust

User Only Security

Elevated Permissions

Apps

User & App Security

Use “App Only”

Break Inheritance Request Permissions

No Resource Monitoring Resource Monitoring

Page 8: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

DEPLOYMENT CHANGES

Full Trust

To Farm

Files in Hive

Assemblies in GAC

WSP Deployment

Apps

To Site Collection

Everything in Content DB

Assemblies Remote

.App Publishing

Page 9: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

What challenges do full trust solutions pose?

Page 10: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

WEB PART REFACTORING

Use client side code

Separate out

SharePoint code

Use REST endpoints

Page 11: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

2010 CHALLENGES

Server-side Code

Full Permissions

Not following Best Practices

Performance and Errors

Unhandled Errors & Crashes

Slow Sites

Development Cycle

Long approval times

Cross Solution Testing

Page 12: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

CROSS PLATFORM DEVELOPMENT

• Languages and technologies

• Lower entry bar

• MVC and MVVP support

• Expanded object model

Page 13: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

How are apps different?

Page 14: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

EVOLUTION OF OBJECT MODEL

SharePoint 2010SharePoint 2007SharePoint 2013

Page 15: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

WHY APPS SHOULD BE USED

• Familiar programming model

• Multiple hosting options

• Flexible web experience

• Integrates with Office apps

• App available to users via–Office Store

– App Catalog

Page 16: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

WHEN TO USE APPS

• Using SharePoint in Office 365

– Apps required

• If On-Premise

– Meets business requirements

• In the Cloud and On-Premise

– Best to use apps

Page 17: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

WHAT HAVE WE COVERED?

ComparisonFull Trust

ChallengesHow Apps Can Help

Page 18: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

GETTING STARTED WITH APPS

Page 19: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

WHAT ARE APPS

• Lightweight web applications– Apps parts hosted in IFrame

• Web scoped–Own isolated app web

• Tenant “shared” scoped– Shared app web across multiple site collections

• Different authentication options– Azure ACS for low trust – on premise or O365

– Digital certificates for high trust – on premise only

Page 20: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

TYPES OF APP

Immersive Full Page

App Part

UI Custom Action

NOT TENANT SCOPED

Page 21: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

App Web

SHAREPOINT-HOSTED APP

1. Isolated app web

2. SharePoint Access

3. Cross-domain library

4. Tenant scope access

Host Web

1

3

JSOM

2

Other Site Collections

4JSOM REST

REST

Page 22: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

PROVIDER-HOSTED APP

1. Client-side object model

2. App Web optional

3. Provide tenant isolation

4. Tenet Scope access

App Web

Host Web

Remote Web

1 2 3

Other Site Collections

1 4

32

REST

SCOM,REST, JSOM

Page 23: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

What’s needed before we can create apps?

Page 24: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

APP PREREQUISITES

On Premise Office 365

Page 25: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

ON PREMISE SETUP

Create Development Farm

Provision Services

User Profile

App Management

Subscription Service

Create Isolated Domain

Configure Settings

App Domain

App Prefix

Page 26: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

CREATING CERTIFICATES

• Create self-signed cert

• Create folder for certs

• Export certs to folder

• Give app pools access

• Register .cer with SP

• Project uses .pfx cert

• App uses .cer cert

IIS Project

AppRegister Cert

.cer.pfx.pfx

Folder

Page 27: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

DEVELOPER TOOLS

• Office 365 developer subscription–Or use a site with developer template

– Develop using “Napa”

• Visual Studio– Professional or higher

– 2012 or 2013 plus latest updates

• Extensions required–Microsoft Office Developer Tools

– NuGet Package installer

Page 28: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

APP INFRASTRUCTURE OVERVIEW

Where Stage RequirementSharePoint

HostedProvider Hosted

Setup

Provision app farm services

Create Isolated app domain Optional

Create certificates & configure trust High Trust

Configure access to Azure AD ACS Low Trust

Setup

Development site collection

Visual Studio 2012 or 2013

Create App catalog

Page 29: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

Lets look at how to do this

Page 30: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

DEMO

• Configuring a developer farm to support apps

Page 31: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

WHAT HAVE WE LEARNED?

What are Apps

App Prerequisites

On Premise Setup

Page 32: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

BUILDING APPS

Page 33: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

APP PROJECT SETUP

• SharePoint location

• Specify hosting model

Page 34: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

PROVIDER-HOSTED OPTIONS

• Choose web app type

• Choose authentication

Page 35: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

SharePoint-Hosted

Provider-Hosted

APP PROJECT STRUCTURE

Page 36: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

CLIENT WEB PART

Properties passed in query string

Properties Defined in here

Reference to web page

Default app part dimensions

Page 37: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

JSOM PATTERN

• Get SharePoint context using app web url

• Define objects to get

• Execute to get objects

• Result sent to async event

Page 38: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

CSOM PATTERN

• Pass in HttpContext to return SP context

• Create user context from the SP context

• Determine what we need

• Group as much in each Load as possible

• Execute to get the data

• Use the data returned

Page 39: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

CROSS DOMAIN

• Get the app web and host web url’s

• Load the cross domain library from the host web

• Specify callback event to access host web objects

Page 40: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

CROSS DOMAIN

• Get the app web context

• AppContextSite used to access host web

• Specify permissions need in AppManifest

Page 41: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

HOST WEB PERMISSIONS

<AppPermissionRequests>

<AppPermissionRequest

Scope="http://sharepoint/content/sitecollection/web"

Right="Manage"

/>

</AppPermissionRequests>

AllowAppOnlyPolicy="true" >

Page 42: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

How do we deploy app components?

Page 43: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

APP COMPONENTS

• Type of app assets– SharePoint lists, document libraries

– Images, css and javascript files

• Deploy from app–When app first accessed

– Required host web manage rights

• Deploy using app event receiver– Receiver added to remote web

– Use azure web sites

Page 44: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

ASSET DEPLOYMENT

• To app web– If isolation required

– Need to sell app

• To host web– Easier user access

– Shared app access

Page 45: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

APP EVENT RECEIVERS

• From app project– Enable property pane

– Service endpoint added to AppManifest

• In web project– Receiver service code class

• Debugging possible– Requires azure service bus reference

Page 46: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

Lets create some Apps

Page 47: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

DEMO

• Create a Provider-hosted app–Office 365

– App event receiver for components

Alt

Page 48: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

THE APP BUILT AND PUBLISHED

Creating an App

App Components

Demo App

Page 49: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

APP PUBLISHING

Page 50: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

APP REGISTRATION – HIGH TRUST

• Provider-hosted apps– Use AppRegNew.aspx Same as Client Id

Hosting url

Required only for apps launched from outside of SharePoint

Not used in high trust apps

Page 51: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

HIGH TRUST SETUP

• Create web site– In web.config add

Page 52: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

How do we publish low trust apps?

Page 53: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

APP REGISTRATION – LOW TRUST

• Provider-hosted apps– Use AppRegNew.aspx Same as Client Id

Hosting url

Required only for apps launched from outside of SharePoint

Same as Client Secret

Page 54: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

AZURE WEB SITES

Add client Id & secret to app settings

Download Publishing Profile

Create web site

Page 55: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

APP DEPLOYMENT – LOW TRUST

App project

Client Id and secret

Publish app

Add to app

catalog

Web project

Add publishing

profile

Publish web to azure

Page 56: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

Lets publish our App

Page 57: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

DEMO

• Publish a low trust app to Office 365

Page 58: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

THE APP IS PUBLISHED

High Trust Apps

Low Trust O365 Apps

Publishing Demo

Page 59: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

UPDATING APPS

Page 60: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

UPDATE BETTER THAN REPLACING

Update due to

• Required for store apps

• Data preserved

Replace will not work

• No control on what users do with App

Page 61: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

KEY POINTS

• Users may not update app–One app version

– Same version after update

– Update logic relies on version number

• Rolls back on error– All components

–App data not lost–Mostly automatic except for custom logic

– Errors reported to UI

Page 62: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

EDGE CASE RISKS

• Installing too little– User using version 1 of app

–Missed going to version 2

– Updates to version 3

– Update logic fails to add version 2 list

– App fails on displaying version 2 list

• Installing too much– User updates from version 2 to 3

– Update logic tries to re-add version 2 list

– Update fails due to existing list

Page 63: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

How should we update Apps?

Page 64: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

Previous updates in version range

Current update

<EndRange = 2.0.0.0>

1.000 - 1.999 For version 1

APP PROJECT PATTERNS

• App web project feature– Use same version as app

• Feature upgrade actions– Never use “Begin Range”

– “End Range” exclusive

• Client web part– Always change name

– Removes old versions

<EndRange = 3.0.0.0>

2.000 - 2.999 For version 1 & 2

Page 65: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

PROVIDER-HOSTED VERSIONING

Pass In App Version

Page V 1

Page V 3Page V 3

App V 1 App V 1

App V 3

?

Page 66: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

UPDATE LOGIC

• Same as app feature pattern

• Add logic to install receiver without checks

Page 67: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

ROLL BACK ON ERROR

Page 68: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

TELL SHAREPOINT

• Result is an SPRemoteEventResult object

Page 69: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

Finally, lets update an app

Page 70: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

DEMO

• Updating our App

Page 71: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

THE APP IS UPDATED

The shift to Updating

How to Update

Demo

Page 72: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

SUMMARY

Building Apps

App Publishing

Updating Apps

Moving From Full Trust

Code

Getting Started with

Apps

Page 73: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

CALL TO ACTION

• Get an O365 Developer License

• Join the PnP Yammer Group

• Visit the PnP GitHub

Page 74: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

FINAL COMMENT

• Now we have a tools and the understanding to create apps and move away from full trust code

• Thank you for listening

Page 75: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

QUESTIONS?

[email protected]

Page 76: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

Established in 2009

Offices in Richfield, OH + Atlanta, GA

Areas of Expertise:• Application Development Consulting

• Cloud Consulting

• Core Infrastructure Consulting

• Managed Services

• Staffing Services

COMPANY OVERVIEW

Page 77: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

MICROSOFT PARTNERSHIP

Awards & Recognition• Microsoft 2014 Partner of the Year,

U.S. Enterprise Services

• Microsoft 2013 Partner of the Year, U.S. Enterprise Services, Commercial Sector

• Microsoft 2012 Partner of the Year, U.S. Enterprise Services, Commercial Sector

• Microsoft 2011 Partner of the Year, U.S. Enterprise Services

Page 78: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

OUR VALUES: THE FOUNDATION

QUALITYWe’re about getting the job done right, developing supportable solutions that perform to our client’s requirements.

VALUEWorking with us will yield excellent value for our client’s investment.

EXCELLENCEWe use our best talent and abilities to create practical and usable software and services.

TRUSTWe partner with our clients to deliver on- time, within budget, with our long-term success a top priority.

Page 79: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

OUR AREAS OF EXPERTISEWhere we SHINE and do AMAZING work!

Page 80: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

We enhance and extend current product functionality or develop new software applications and capabilities. We ensure that your applications support your immediate and future business needs. We also help leverage and integrate into your existing systems and devices, enabling you to take better advantage of your investments.

APPLICATION DEVELOPMENT

Page 81: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

We help you leverage your existing investments, infrastructure and skill sets to build the right cloud solution for your business—one that will scale securely and work for you today and in the future.

CLOUD

Page 82: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

We bring proven methodologies, tools and processes to enable easier manageability, monitoring, implementations, migrations and updates to key infrastructure technologies. This also includes adoption of cloud solutions when it is appropriate for your business.

CORE INFRASTRUCTURE

Page 83: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

We enable you to optimize and reduce the cost of key business systems by managing your Windows ™ infrastructure – servers and software – by providing remote technical support assistance. Our best in class tools and resources provide peace of mind when tackling the challenges of managing your infrastructure, freeing you up to focus on strategic business needs.

MANAGED SERVICES

Page 84: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

We pair the right technologist with the right company – whether it’s for a short-term engagement or long-term employment. We access the needs, goals and personalities to make the right fit.

STAFFING

Page 85: Transitioning to SharePoint App Development

ProSource Solutions, LLC. | www.prosourcesolutionsllc.com

Financial Services

Manufacturing Government Healthcare Services

INDUSTRIES WE SERVE