chris o'brien - comparing sharepoint add-ins (apps) with office 365 apps

43
New developer choices - comparing SharePoint add-ins (apps) with Office 365 apps Chris O’Brien – MVP www.sharepointnutsandbolts.com

Upload: chris-obrien

Post on 04-Aug-2015

9.047 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

New developer choices - comparing SharePoint add-ins (apps) with Office 365 apps

Chris O’Brien – MVPwww.sharepointnutsandbolts.com

Page 2: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

Independent ConsultantHead of Development, Content and Code

www.sharepointnutsandbolts.com@ChrisO_Brien http://cob-sp.com/COBLinkedIn

About me

Page 3: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

Warning! Name change

“SharePoint Apps”

(or more correctly,

“Apps for SharePoint“)

Page 4: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

Warning! Name change

…are now:

“SharePoint Add-Ins!”

Page 5: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

AgendaChanges in SharePoint development – apps, 2 years on..SharePoint Add-Ins – a recapOffice 365 apps

- Why did Microsoft introduce these? What do they promise?

Comparing SharePoint Add-Ins with Office 365 apps- For the end-user, administrator and developer

Summary

Page 6: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

SP2003 – hacking in ASPX files SP2010 – WSPs and CSOM

Now – As above + Office 365

APIs

A brief history

Page 7: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

The SharePoint App Model – "State of the Nation"

Page 8: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

Apps, 2 years on – THE GOODMicrosoft continuing to push - it’s not going away

Improved APIs | OfficeDev samples | More documentation

Established patterns for “timer jobs”, “web parts” etc.

More belief that business requirements can be metSome on-premise development is now done with apps

The model is WORKING! Office 365 IS customisable AND stable

Page 9: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

Apps, 2 years on – THE BADStore/store apps have had limited impact

Some developer pain around branding, site provisioning, other things we used Features for..

User experience not ideal – app accessed from a SharePoint site

Raises the bar even higher to be a SharePoint developer?

Page 10: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

What developers say about apps..

“I get it, but things are harder/take longer”

“So I have to write code to create fields and content types now?

Really?”

“Getting on-premises infrastructure sorted for apps is painful!”

Page 11: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

What end-users say about apps..

“Why can’t I go directly into [tool X] in my browser?“

“It doesn’t make sense to go from a SharePoint site!”

“It doesn’t work well on my phone!”

Page 12: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

What was needed

Something less tied to SharePoint

Something which works well on mobile devices

Something easier for non-SharePoint developers to pick up

Page 13: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

Let me introduce our client..

Page 14: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

This is Joe

(Office 365 intranet

manager)

Page 15: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

Build me a meetings app!!

It needs to:

–Allow selection of attendees

–Stores agenda of meeting in

SharePoint doc lib

– Inserts entry into calendar of

attendees

–Tracks booked meetings to a

SharePoint list somehow

–Work well on mobile devices

Page 16: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

This is our brave

dev team

Page 17: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

Dev team questions

We’ll come back to this scenario later…

Do the Office 365 APIs

cover the requirements?What about the

user experience?

How would we roll it

out “globally”?

Page 18: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

Solve common problems with Add-Ins

Full trust (farm) solution Remote code/apps

Timer job Scheduled process in Azure (CSOM to read/write to SP)

Event receiver Remote event receiver

Custom field control JSLink

Site definition 1. Remote provisioning solution2. WebTemplate in NCSS * (less preferred)

Run With Elevated Privileges App-only authentication

Custom web parts/user control App part, or JavaScript injection

Feature receiver, DelegateControl, application page

None – but other approaches possible

* NCSS = no-code sandbox solution

Page 19: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

Demo

SHAREPOINT ADD-INS: END-USER AND ADMIN

Page 20: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

Click “next slide” to see this demo on YouTube, or use link:https://www.youtube.com/watch?v=cNi353Mpwyk

Page 21: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

Key takeaways – SharePoint Add-Ins

Installed to SharePoint sites

Generally accessed from Site Contents page

Can be “admin-deployed” via a tenant-scoped app install

Page 22: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

Offi ce 365 apps

Page 23: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

What is an Office 365 app?A “standalone” app (e.g. ASP.NET) which uses O365 data/services via specific APIs

Registered with Azure AD (behind O365)

Integrated with Office 365 user experience (app

launcher)

Could be mobile/platform specific

Page 24: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

Office 365 apps – the vision

“Everyone” has an

Office 365 account

(kinda!)

Lots of apps need to:

- store files,

- send mail/ calendar

invites etc.

Use Office 365 instead

of app’s own!

“Making it easy for other platforms/devices to make use of

Office 365”

Page 25: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

Office 365 apps – the promiseGeneric services (not tech platforms)

Mail, Contacts, Calendar (Exchange)Files (SharePoint)Users and Groups (Azure AD)

Simpler to develop with - no need to be a “career” SP developer

More flexible UI – not installed to SharePoint site

AIM:

Remove differences

between SharePoint

and Exchange

(e.g. app which stores

e-mail attachments to

OneDrive)

Page 26: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

Demo

OFFICE 365 APPS: END-USER AND ADMIN

Page 27: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

Click “next slide” to see this demo on YouTube, or use link:https://www.youtube.com/watch?v=xznfjNFIlAU

Page 28: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

Key takeaways – Office 365 apps

Registered in Azure AD

Users can browse to app “directly” – and asked to sign-in if needed

When app is assigned to user, shows in their “My apps” page

Page 29: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

Development differences

Page 30: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

API formsCore REST API Gives you full control.. ..but more work to do (e.g. authentication)

Various client libraries (helpers) .NET JavaScript iOS/Android etc.

Page 31: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

Office 365 API capabilities

Mail Contacts

Calendar Files

Users &

groups

Discovery

Service

Expense app:

Looks up user’s

manager

Sends mail with details

Expense form/receipt

saved to ODFB site

Page 32: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

Fetching files (.NET client library)

var sharePointClient = await AuthenticationHelper.EnsureSharePointClientCreatedAsync("MyFiles");

var filesResults = await sharePointClient.Files.ExecuteAsync();var files = filesResults.CurrentPage;

foreach (IItem fileItem in files){

// do something..}

Page 33: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

Fetching e-mail (.NET client library)

var outlookServicesClient = await AuthenticationHelper.EnsureOutlookServicesClientCreatedAsync("Mail");

var mailResults = await (from i in outlookServicesClient.Me.Folders.GetById("Inbox").Messages orderby i.DateTimeReceived descending select i).Skip((pageNo - 1) * pageSize).Take(pageSize).ExecuteAsync();

var mailMessages = mailResults.CurrentPage;

foreach (IMessage serverMailItem in mailMessages){

// do something..}

Page 34: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

Other uses of Azure ADSecuring any web app (e.g. provider-hosted apps!)

-> Get SSO with Office 365

Securing services you develop (e.g. WebAPI)

-> Allows hosting in cloud(since you wouldn’t

want anonymous access allowed)

Page 35: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

Getting started with Office 365 APIsOption 1 – best for new

apps

•Start app from OfficeDev MVC Starter

Project (

http://cob-sp.com/O365MvcStarter)

•Integrate your functionality into this app

•Simplest approach

Option 2 – best for

existing apps

•Use existing application

•Integrate Office 365 APIs into project using

MSDN article -

http://cob-sp.com/O365AppStart

•Copy in code/web.config settings etc.

•More steps to do

Page 36: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

Demo

DEVELOPING OFFICE 365 APPS: GETTING STARTED

Page 37: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

Click “next slide” to see this demo on YouTube, or use link:https://www.youtube.com/watch?v=B8w1oJj3eJw

Page 38: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

Key differences for developersSharePoint Add-Ins Office 365 app

APIs SharePoint CSOM/REST (.NET or JavaScript)

Office 365 APIs (REST + many libraries)

Authentication SharePoint context/access tokens Azure AD auth

Hosting SharePoint-hosted/provider-hosted Provider-hosted

Deployment Installed to SharePoint site Standalone

Mobile support No “native” apps – just web Support for iOS/Android/Windows 8 native apps (specific API client libraries)

Page 39: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

But I can’t do it with the Office 365 APIs!

ClientContext ctx = new ClientContext(SiteUrlTxt.Text);ctx.ExecutingWebRequest += ctx_ExecutingWebRequest;ctx.Load(ctx.Web.Lists);ctx.ExecuteQuery();

async void ctx_ExecutingWebRequest(object sender, WebRequestEventArgs e){   AuthenticationResult ar = await AcquireTokenAsync(CommonAuthority,       GetSharePointHost(SiteUrlTxt.Text));    if (ar != null)   {       e.WebRequestExecutor.RequestHeaders[“Authorization”] =          “Bearer ” + ar.AccessToken;   }}

Possible to use an Azure AD token (from ADAL) with SharePoint CSOM/REST APIs:

https://samlman.wordpress.com/2015/02/27/using-adal-access-tokens-with-o365-rest-apis-and-csom/

Page 40: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

Key differences summarisedApp for SharePoint Office 365 app

How app is accessed

SharePoint site (Site Contents page) App Launcher/My Apps page

(or direct link to app)

App registration Registered with AppRegNew.aspx Registered in Azure AD

App deployment

SharePoint app catalog/installed to site Standalone

Users assigned to app in Azure AD

Authentication Access/context tokens – handled by SharePointContext class

Handled by client libraries/ADAL libraries

Page 41: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

Office 365 app *would* be a good

foundation here:

APIs cover most of the requirements

(calendaring, contacts etc.)

The user experience would work well –

accessible anywhere in Office 365

Option of creating a device specific app

(e.g. iOS)

BUT:

Would need to step outside O365 APIs for

writing to SharePoint lists -> no drama,

could use same auth token in CSOM code

Back to our scenario..

Page 42: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

Summary

Apps are really about REMOTE CODE Office 365 apps = just an extension of this model

Office 365 apps are great for “cross-service” capability

Capability will grow – this will become a standard approach

Some differences to consider: End-user | Admin | Developer

Page 43: Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps

Thank you for attending!

Chris O’Brienwww.sharepointnutsandbolts.com