Upload
trinhque
View
258
Download
2
Embed Size (px)
Citation preview
Building Cloud hosted apps for SharePoint with PHP and node.JS Todd Baginski – SharePoint MVPVice President – Canviz Consulting
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]
AgendaSharePoint 2013 App ModelsCloud-hosted app technologiesCloud-hosted application componentsCloud-hosted AuthN / AuthZPHP and nodeCollaboration / ECMBusiness IntelligenceWeb Content Management
SharePoint 2013 App Models
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
Cloud-hosted app technologies
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!
Cloud-hosted application components
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
Cloud-hosted AuthN / AuthZ
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
Granting / Removing SharePoint App PermissionsEnd-user consent (previous slide)By tenant or web site administratorsWhen an app is removed
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
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
OAuth Flow
SharePoint Server
Hosting Server
Web Browser
ACS Server
SharePoint Server
Hosting ServerWeb Browser
ACS Server
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
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
ACS Server
3) ACS returns the signed context token
https://mySPSite.sharepo
SharePoint Server
Hosting ServerWeb Browser
132
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
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
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
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
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
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
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
PHP and node
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
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/
Collaboration / ECM
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
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
Cloud hosted collaboration / ECM app
Business Intelligence
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
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
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
Cloud hosted business intelligence app
Web Content Management
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!
Thank You
© 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.