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

Post on 04-Aug-2015

9.047 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

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

Chris O’Brien – MVPwww.sharepointnutsandbolts.com

Independent ConsultantHead of Development, Content and Code

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

About me

Warning! Name change

“SharePoint Apps”

(or more correctly,

“Apps for SharePoint“)

Warning! Name change

…are now:

“SharePoint Add-Ins!”

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

SP2003 – hacking in ASPX files SP2010 – WSPs and CSOM

Now – As above + Office 365

APIs

A brief history

The SharePoint App Model – "State of the Nation"

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

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?

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!”

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!”

What was needed

Something less tied to SharePoint

Something which works well on mobile devices

Something easier for non-SharePoint developers to pick up

Let me introduce our client..

This is Joe

(Office 365 intranet

manager)

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

This is our brave

dev team

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”?

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

Demo

SHAREPOINT ADD-INS: END-USER AND ADMIN

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

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

Offi ce 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

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”

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)

Demo

OFFICE 365 APPS: END-USER AND ADMIN

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

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

Development differences

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.

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

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..}

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..}

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)

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

Demo

DEVELOPING OFFICE 365 APPS: GETTING STARTED

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

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)

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/

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

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..

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

Thank you for attending!

Chris O’Brienwww.sharepointnutsandbolts.com

top related