building cloud-hosted apps for sharepoint with php and node.js

43

Upload: trinhque

Post on 04-Feb-2017

236 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Building Cloud-hosted apps for SharePoint with PHP and node.JS
Page 2: Building Cloud-hosted apps for SharePoint with PHP and node.JS

Building Cloud hosted apps for SharePoint with PHP and node.JS Todd Baginski – SharePoint MVPVice President – Canviz Consulting

Page 3: Building Cloud-hosted apps for SharePoint with PHP and node.JS

About MeVice President – Mobility & SharePoint Solutions – Canviz Consulting7 Time SharePoint Server MVPSharePoint MCM – BCS Author and InstructorWeb Site: http://www.canviz.comBlog: http://www.toddbaginski.com/blogTwitter: @toddbaginskiEmail: [email protected]

Page 4: Building Cloud-hosted apps for SharePoint with PHP and node.JS

AgendaSharePoint 2013 App ModelsCloud-hosted app technologiesCloud-hosted application componentsCloud-hosted AuthN / AuthZPHP and nodeCollaboration / ECMBusiness IntelligenceWeb Content Management

Page 5: Building Cloud-hosted apps for SharePoint with PHP and node.JS

SharePoint 2013 App Models

Page 6: Building Cloud-hosted apps for SharePoint with PHP and node.JS

Possible SharePoint App ArchitecturesSharePoint Hosted Autohosted Provider-hosted

Any host

• All components deployed to SharePoint

• Client side code• App Web created for

app

• Wrapper deployed to SharePoint

• Components deployed to Azure (automatically)

• Server and client side code

• Wrapper deployed to SharePoint

• Components deployed to host (manually)

• Server and client side code

PHP /

Node

PHP /

Node

Page 7: Building Cloud-hosted apps for SharePoint with PHP and node.JS

Cloud-hosted app technologies

Page 8: Building Cloud-hosted apps for SharePoint with PHP and node.JS

What technologies can you use?

• SQL, mySQL, Oracle, CSV, Access, FoxPro, DB2, SQLite

Data

• C#, VB.NET, PHP, CGI, Java, Perl, Ruby, Node.js

Server code

• HTML4/5, JavaScript, jQuery, Silverlight, Flash, AJAX

User interface code

Anything!

Page 9: Building Cloud-hosted apps for SharePoint with PHP and node.JS

Cloud-hosted application components

Page 10: Building Cloud-hosted apps for SharePoint with PHP and node.JS

What components can you use?

Web Pages• jQuery• jQuery Plug-ins• CSS

Jobs• Long running• Automated

Data Sources• Databases• Services• Queues• Subscriptions• Notifications

Services• Notifications• Subscriptions• Email• Workflow

Page 11: Building Cloud-hosted apps for SharePoint with PHP and node.JS

Cloud-hosted AuthN / AuthZ

Page 12: Building Cloud-hosted apps for SharePoint with PHP and node.JS

Granting SharePoint App PermissionsPermissions are granted when an App for SharePoint is installed on a SharePoint server.

App permission

name

SharePoint permission

nameRead ReaderWrite ContributorManage DesignerFullControl Full Control All or

nothing

Page 13: Building Cloud-hosted apps for SharePoint with PHP and node.JS

Granting / Removing SharePoint App PermissionsEnd-user consent (previous slide)By tenant or web site administratorsWhen an app is removed

Page 14: Building Cloud-hosted apps for SharePoint with PHP and node.JS

Common Provider-hosted App Permission Scopes

Scope Pertains ToBCS Read access to BCS data sourcesList * A SharePoint listSearch The SharePoint Search ServiceSite Collection * A SharePoint Site CollectionTaxonomy The SharePoint Taxonomy ServiceWeb * A SharePoint Web SiteWorkflow The Windows Azure Workflow

Service

Page 15: Building Cloud-hosted apps for SharePoint with PHP and node.JS

App PrincipalUniquely identifies a SharePoint appCreate the app principal with AppRegNew.aspxUse the app principal with OAuth for access to SharePoint APIs

http://mySPSite.sharepoint.com/_layouts/15/AppRegNew.aspx

Page 16: Building Cloud-hosted apps for SharePoint with PHP and node.JS

OAuth Flow

SharePoint Server

Hosting Server

Web Browser

ACS Server

Page 17: Building Cloud-hosted apps for SharePoint with PHP and node.JS

SharePoint Server

Hosting ServerWeb Browser

ACS Server

Page 18: Building Cloud-hosted apps for SharePoint with PHP and node.JS

1) User browses to a SharePoint page with an app from a Cloud hosted app on it

https://mySPSite.sharepo

SharePoint Server

Hosting ServerWeb Browser

1

ACS Server

Page 19: Building Cloud-hosted apps for SharePoint with PHP and node.JS

ACS Server

2) SharePoint asks ACS to create and sign a token which contains context information and an auth code

https://mySPSite.sharepo

SharePoint Server

Hosting ServerWeb Browser

12

Page 20: Building Cloud-hosted apps for SharePoint with PHP and node.JS

ACS Server

3) ACS returns the signed context token

https://mySPSite.sharepo

SharePoint Server

Hosting ServerWeb Browser

132

Page 21: Building Cloud-hosted apps for SharePoint with PHP and node.JS

4) SharePoint renders the page including an IFRAME, which will POST the context token to the Cloud hosted app

Developer Site

POST https://hosting server/…SPAppToken=tbAgAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.e…

https://mySPSite.sharepo

ACS Server

SharePoint Server

Hosting ServerWeb Browser

12

4

3

Page 22: Building Cloud-hosted apps for SharePoint with PHP and node.JS

5) The IFRAME causes the browser to request a page from the Cloud hosted app including the context token

ACS Server

SharePoint Server

Hosting ServerWeb Browser

12

4

3

5

Developer Sitehttps://mySPSite.sharepo

Page 23: Building Cloud-hosted apps for SharePoint with PHP and node.JS

6) Cloud hosted app validates the signature on the context token, extracts the auth code, and uses its credentials to request an access token from ACS

ACS Server

SharePoint Server

Hosting ServerWeb Browser

12

4

3

6

5

Developer Sitehttps://mySPSite.sharepo

Page 24: Building Cloud-hosted apps for SharePoint with PHP and node.JS

7) ACS returns an access token

ACS Server

SharePoint Server

Hosting ServerWeb Browser

12

4

3

67

5

Developer Sitehttps://mySPSite.sharepo

7) ACS returns an access token

Page 25: Building Cloud-hosted apps for SharePoint with PHP and node.JS

8) Cloud-hosted app makes a web service request to SharePoint, passing the access token

ACS Server

SharePoint Server

Hosting ServerWeb Browser

12

4

3

67

5

8

Developer Sitehttps://mySPSite.sharepo

Page 26: Building Cloud-hosted apps for SharePoint with PHP and node.JS

9) SharePoint returns information to the Cloud hosted app

ACS Server

SharePoint Server

Hosting ServerWeb Browser

12

4

3

67

5

89

Developer Sitehttps://mySPSite.sharepo

Page 27: Building Cloud-hosted apps for SharePoint with PHP and node.JS

10) The Cloud hosted app renders the IFRAME contents

ACS Server

SharePoint Server

Hosting ServerWeb Browser

12

4

3

67

5

89

Sales Metrics Dashboard

Print Report

Email Report Refresh

10

Developer Sitehttps://mySPSite.sharepo

Page 28: Building Cloud-hosted apps for SharePoint with PHP and node.JS

PHP and node

Page 29: Building Cloud-hosted apps for SharePoint with PHP and node.JS

PHP SpecificsCreate web pages with PHP, HTML, JavaScriptUse a JSON Web Token Encoder and LibraryJWTUse cURL to submit requestsGet the token from ACSInvoke SharePoint REST queries and operations

Page 30: Building Cloud-hosted apps for SharePoint with PHP and node.JS

Node SpecificsAzure support is tremendousAnything you can do in node you can do in a Cloud hosted appSee the developer centerhttp://www.windowsazure.com/en-us/develop/nodejs/

Page 31: Building Cloud-hosted apps for SharePoint with PHP and node.JS

Collaboration / ECM

Page 32: Building Cloud-hosted apps for SharePoint with PHP and node.JS

Cloud hosted Collaboration & ECMDocument managementStore documents in SharePoint, build you own interfaces to manage, work, and integrate documents with business processes.

TaxonomyStore taxonomy in SharePoint, build you own interfaces to navigate items in the taxonomy or manage the taxonomy, or use the terms in the term store within your own app

Page 33: Building Cloud-hosted apps for SharePoint with PHP and node.JS

Provider-hosted ECM Example

SharePoint Serverhttp://domainA.com

REST queries to a SharePoint Document Library

• List Documents In A Document Library

• Upload Documents• Check Out Documents• Edit Document Metadata• Check In Documents

Provider-hosted ECM apphttp://domainB.com/page.php

<IFRAME src=“http://domainB.com/page.p

hp”>

Provider hosted ECM app

</IFRAME>

SharePoint Document Libraries

Page 34: Building Cloud-hosted apps for SharePoint with PHP and node.JS

Cloud hosted collaboration / ECM app

Page 35: Building Cloud-hosted apps for SharePoint with PHP and node.JS

Business Intelligence

Page 36: Building Cloud-hosted apps for SharePoint with PHP and node.JS

Cloud hosted Business IntelligenceGather information from SharePoint sitesUse SharePoint for data entry / maintenanceUse List Item Event Receivers to add data to the data warehouse

Aggregate and analyze dataDashboardsKPIs

Integrate with business processesNotificationsAutomation

Page 37: Building Cloud-hosted apps for SharePoint with PHP and node.JS

Cloud hosted BI Example

HomeFinance

Departments

North

South

East

West

Parts Inventory ListList Item Event Receiver

Autohosted / Provider-hosted app

Windows Azure SQL Database

Windows Azure Web

Site(node.js)

Part A Part B Part C Part D

Cloud hosted app

Page 38: Building Cloud-hosted apps for SharePoint with PHP and node.JS

Cloud hosted BI Example

SharePoint Serverhttp://domainA.com/sites/<1..N>

<IFRAME>Autohosted BI app

</IFRAME>

Windows Azure SQL Database

Windows Azure Web

Site6 2

3

3

4

Windows Azure

Worker Role

Azure Service Bus

Topics / Subscriptio

ns

5

87

Cloud hosted BI apphttp://domainB.com/page.php

Parts Inventory List

1

Remote Event Receiver

Page 39: Building Cloud-hosted apps for SharePoint with PHP and node.JS

Cloud hosted business intelligence app

Page 40: Building Cloud-hosted apps for SharePoint with PHP and node.JS

Web Content Management

Page 41: Building Cloud-hosted apps for SharePoint with PHP and node.JS

Provider-hosted WCMExtend SharePoint’s WCM capabilitiesOffice 365 Small Business Site

Create robust web enabled ways to present contentSorting, filtering, grouping, searching

On-premisesCreate line of business applications that run on other serversCreate them with any technology!

Page 42: Building Cloud-hosted apps for SharePoint with PHP and node.JS

Thank You

Page 43: Building Cloud-hosted apps for SharePoint with PHP and node.JS

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