SlideShare une entreprise Scribd logo
1  sur  24
Télécharger pour lire hors ligne
Building Great
Client-side Web
Parts with SPFx, PnP-
JS-Core, ReactJS
and Office UI Fabric
Bill Ayers
14 octobre 2017
#SPSParis
Merci pour votre soutien
Eur Ing Dr Bill Ayers
MCM/MCSM Charter SharePoint
MVP, MCT, MCTS, MCITP, MCSD, MCAD, MCSA, MCDBA, Professional
Scrum Master, etc. etc.
Flow Simulation Ltd.
www.SPDoctor.net
BillA@flosim.com
@SPDoctor
Consultant specialising in SharePoint and
Office 365 Development and Architecture
for Collaboration and Mobile Development
• SharePoint Development Backstory
• The SharePoint Framework
• ReactJS
• Office UI Fabric
• OfficeDev PnP and PnP-JS-Core library
• Building an SPFx WebPart
• Conclusions
Agenda
Cloud Hosted Add-ins
Remote Web
S2S Trust
OAuth (O365)
SharePoint Web Server
Managed CSOM
or REST
Cross-domain Request
Host Web
X D
• Branding
• Add behaviour
• Script Editor Web Part
• Effective, but many problems
SharePoint/Office 365
SharePoint Page
SPWeb
JavaScript Injection
JavaScript
Managed CSOM
or REST API
or MS Graph API
Limitations
• No deployment or packaging model – DIY
• No central control
• Master page may change!
• Scripting disabled by default for personal sites and self-service sites in
SharePoint Online and root site collection
• When scripting is disabled…
• Links removed from Site Settings page
• SharePoint Designer capabilities reduced
• Can’t edit master pages or page layouts
• Can’t edit theme for current site
• Missing Web Parts (e.g. Script Editor, Content Editor)
• Can’t upload .aspx files to document libraries
• Enable scripting with UI, CSOM or PowerShell
Introducing the SharePoint
Framework (SPFx)
Model for building client-side pages, web
parts and more
Announced May 4th 2016, now GA!
Authoring canvas, no iFrames
Command-line-driven open-source
toolchain (or community VS extension)
Used by SharePoint product team
Works in “modern” and “classic” pages
Your choice of client-side framework;
Angular, React, Knockout, Vanilla.JS ;-)
Office 365/SharePoint Online
On-premises: SP2016 FP2 (now GA)
Modern Site Pages
Easily create powerful, beautiful looking
pages
Modern building blocks
Mobile support is built in from the start
Pages get better with the Microsoft Graph
New SPFx Extension Types
Announced at //build/ 2017
• ApplicationCustomizers allow developers to add script to the page, as
well as access well-known HTML element placeholders and extend
them with custom renderings
• FieldCustomizers can be used to provide modified views to data for
fields within a list
• CommandSets let developers extend the command surfaces of
SharePoint to add new actions, along with client-side code that can be
used to implement behaviours
• Web Part Connections enable more connected web parts that can work
together to share information
• Communication Sites (announced at #SPSummit)
Wait, did you say
“Command-line-driven
open-source toolchain” ?
Things You Need…
• Node.js (LTS version)
• Gulp
• Yeoman
• Git
• Editor (e.g. VS Code)
• Yeoman generator for SharePoint Framework
• Technologies like WebPack, SASS and other libraries will
be installed by Node’s package manager - NPM
…or use Visual Studio extension:
https://github.com/SharePoint/sp-dev-fx-vs-extension
• Features of next version(s) of
JavaScript/ECMAScript standard
• Compiles to JavaScript (ES5)
• Strong typing, classes
• Original design goal was to make JavaScript
easier for C# developers
• Makes it easier to write production quality
JavaScript
• Good support in VS Code
• Development language for the base templates in
SharePoint Framework
https://www.typescriptlang.org/
ReactJS
• Backed by Facebook and Instagram
• Component design (composition)
• Very fast Virtual DOM page rendering model
• Provides the view engine only
• JSX format takes some getting used to 
• TypeScript Compiler has support for JSX (TSX)
• Used by Microsoft
• ReactJS tutorial: https://zapier.com/engineering/react-js-tutorial-guide-
gotchas/ or https://facebook.github.io/react/
var button = <Button>Hello, world!</Button>;
Office UI Fabric
• Responsive framework (kind-of)
• Office Design Language for web
• Designed for Office Add-ins by
OneDrive and SharePoint Design Studio
• Consistent look-and-feel with Office
• “Modern”, not “classic” SharePoint CSS
• About 100k, 200k with components
• Available as raw CSS or versions for Angular and React
• Dev.office.com/fabric
Office UI Fabric
• Design elements to give add-ins the same look
and feel as the rest of the Office suite
• Consistent typography, icons and behaviour
Link to UI Fabric Stylesheets:
<link rel="stylesheet" href="https://appsforoffice.microsoft.com/fabric/1.2.0/fabric.min.css">
<link rel="stylesheet" href="https://appsforoffice.microsoft.com/fabric/1.2.0/fabric.components.min.css">
Decorate elements with UI Fabric classes:
<button class="ms-Button" id="get-data-from-selection">
<span class="ms-Button-icon"><em class="ms-Icon ms-Icon--plus"></em></span>
<span class="ms-Button-label">Get Data from selection</span>
<span class="ms-Button-description">Get Data from the document selection</span>
</button>
http://dev.office.com/fabric
Link to UI Fabric JS:
<script src="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-js/1.2.0/js/fabric.min.js"></script>
Office UI Fabric ReactJS
Components
• 30 re-useable React components, ready to use
• Used by Microsoft to build Office and SharePoint
• Angular? See ngOfficeUIFabric
import Button from 'office-ui-fabric-react';
Var b = <Button onClick={() => this.getData() }
className="ms-Button--primary">
Refresh List</Button>
Breadcrumb
Button
Callout
Checkbox
ChoiceGroup
ColorPicker
CommandBar
ContextualMenu
DatePicker
DetailsList
Dialog
DocumentCard
Dropdown
Facepile
GroupedList
Image
Label
Layer
Link
List
MessageBar
Nav
Overlay
Panel
Persona
Pickers
PeoplePicker
Pivot
ProgressIndicator
SearchBox
Slider
Spinner
TextField
Toggle
OfficeDev PnP Initiative
• PnP-JS-Core
• Still under development
• JavaScript wrapper for SharePoint REST APIs
• Good fit for SPFx development
• Github.com/SharePoint/PnP-JS-Core
• “Home” of SPFx guidance, documentation, samples, etc.
• Dev.Office.com/SharePoint is starting point
• Code hosted on GitHub
Looking at ReactJS
Looking at Office UI Fabric
Looking at OfficeDev PnP-JS-Core
Building an SPFx WebPart
Conclusions
• “Modern” SharePoint development
tools are your choice
• The “old” stuff still works
• Build re-usable components with
ReactJS
• PnP-JS-Core makes SharePoint
REST easy
• Office-UI-Fabric makes web parts
beautiful
• We are on a journey – join us!
Resources:
• http://dev.office.com/SharePoint
• http://dev.office.com/fabric
• https://facebook.github.io/react/
• https://github.com/SharePoint/PnP-JS-Core
• https://github.com/OfficeDev/TrainingContent/SharePoint
• http://github.com/SPDoctor/SPFXShoppingList
Bingle
Thank you, for your for #SPSParis

Contenu connexe

Tendances

SharePoint - Creating Beautiful Yet Powerful Dashboards Using jQuery
SharePoint - Creating Beautiful Yet Powerful Dashboards Using jQuerySharePoint - Creating Beautiful Yet Powerful Dashboards Using jQuery
SharePoint - Creating Beautiful Yet Powerful Dashboards Using jQuery
Ken Kuzdas
 
Dynamic no-code mashups in SharePoint 2010 and 2013
Dynamic no-code mashups in SharePoint 2010 and 2013Dynamic no-code mashups in SharePoint 2010 and 2013
Dynamic no-code mashups in SharePoint 2010 and 2013
C/D/H Technology Consultants
 
SPUnite17 Migrating your Customizations from On-prem to SharePoint Online
SPUnite17 Migrating your Customizations from On-prem to SharePoint OnlineSPUnite17 Migrating your Customizations from On-prem to SharePoint Online
SPUnite17 Migrating your Customizations from On-prem to SharePoint Online
NCCOMMS
 

Tendances (20)

Modern SharePoint, the Good, the Bad, and the Ugly
Modern SharePoint, the Good, the Bad, and the UglyModern SharePoint, the Good, the Bad, and the Ugly
Modern SharePoint, the Good, the Bad, and the Ugly
 
Uncovering the Latest in SharePoint Development
Uncovering the Latest in SharePoint DevelopmentUncovering the Latest in SharePoint Development
Uncovering the Latest in SharePoint Development
 
Introduction to SharePoint Framework
Introduction to SharePoint FrameworkIntroduction to SharePoint Framework
Introduction to SharePoint Framework
 
Add ins share-point provider hosted
Add ins share-point provider hostedAdd ins share-point provider hosted
Add ins share-point provider hosted
 
SharePoint - Creating Beautiful Yet Powerful Dashboards Using jQuery
SharePoint - Creating Beautiful Yet Powerful Dashboards Using jQuerySharePoint - Creating Beautiful Yet Powerful Dashboards Using jQuery
SharePoint - Creating Beautiful Yet Powerful Dashboards Using jQuery
 
Developing with SharePoint Framework (SPFx) on-premises
Developing with SharePoint Framework (SPFx) on-premisesDeveloping with SharePoint Framework (SPFx) on-premises
Developing with SharePoint Framework (SPFx) on-premises
 
SPUnite17 SPFx Extensions
SPUnite17 SPFx ExtensionsSPUnite17 SPFx Extensions
SPUnite17 SPFx Extensions
 
Dynamic no-code mashups in SharePoint 2010 and 2013
Dynamic no-code mashups in SharePoint 2010 and 2013Dynamic no-code mashups in SharePoint 2010 and 2013
Dynamic no-code mashups in SharePoint 2010 and 2013
 
Move past bootstrap and build our lightweight responsive framework w.v1.2
Move past bootstrap and build our lightweight responsive framework w.v1.2Move past bootstrap and build our lightweight responsive framework w.v1.2
Move past bootstrap and build our lightweight responsive framework w.v1.2
 
SPUnite17 Introduction to the Office Dev PnP Core Libraries
SPUnite17 Introduction to the Office Dev PnP Core LibrariesSPUnite17 Introduction to the Office Dev PnP Core Libraries
SPUnite17 Introduction to the Office Dev PnP Core Libraries
 
Branding Deployment in Office 365 and SharePoint 2013/2016
Branding Deployment in Office 365 and SharePoint 2013/2016Branding Deployment in Office 365 and SharePoint 2013/2016
Branding Deployment in Office 365 and SharePoint 2013/2016
 
SPUnite17 Migrating your Customizations from On-prem to SharePoint Online
SPUnite17 Migrating your Customizations from On-prem to SharePoint OnlineSPUnite17 Migrating your Customizations from On-prem to SharePoint Online
SPUnite17 Migrating your Customizations from On-prem to SharePoint Online
 
[Jansen] Transforming your classic team sites into modern group connected tea...
[Jansen] Transforming your classic team sites into modern group connected tea...[Jansen] Transforming your classic team sites into modern group connected tea...
[Jansen] Transforming your classic team sites into modern group connected tea...
 
SharePoint Framework - Developer Preview
SharePoint Framework - Developer PreviewSharePoint Framework - Developer Preview
SharePoint Framework - Developer Preview
 
ECS19 - Vesa Juvonen - Getting Started With SharePoint Framework - Roadmap
ECS19 - Vesa Juvonen - Getting Started With SharePoint Framework - RoadmapECS19 - Vesa Juvonen - Getting Started With SharePoint Framework - Roadmap
ECS19 - Vesa Juvonen - Getting Started With SharePoint Framework - Roadmap
 
Introduction to Office 365 PnP- Reusable solutions
Introduction to Office 365 PnP- Reusable solutionsIntroduction to Office 365 PnP- Reusable solutions
Introduction to Office 365 PnP- Reusable solutions
 
ECS19 - Katja Jokisalo - Modernize your Intranet
ECS19 - Katja Jokisalo - Modernize your IntranetECS19 - Katja Jokisalo - Modernize your Intranet
ECS19 - Katja Jokisalo - Modernize your Intranet
 
ECS19 - John White - Unlock SharePoint’s Reporting Secrets
ECS19 - John White - Unlock SharePoint’s Reporting SecretsECS19 - John White - Unlock SharePoint’s Reporting Secrets
ECS19 - John White - Unlock SharePoint’s Reporting Secrets
 
What's in SharePoint land 2016 for the end user
What's in SharePoint land 2016 for the end userWhat's in SharePoint land 2016 for the end user
What's in SharePoint land 2016 for the end user
 
Chris O'Brien - Modern SharePoint sites and the SharePoint Framework - reference
Chris O'Brien - Modern SharePoint sites and the SharePoint Framework - referenceChris O'Brien - Modern SharePoint sites and the SharePoint Framework - reference
Chris O'Brien - Modern SharePoint sites and the SharePoint Framework - reference
 

Similaire à SPS Paris: Building great client-side web parts with spfx, pnp-js-core, ReactJS and Office UI Fabric

Yo Office! Use your SPFx Skills to Build Add-Ins for Word, Excel, Outlook and...
Yo Office! Use your SPFx Skills to Build Add-Ins for Word, Excel, Outlook and...Yo Office! Use your SPFx Skills to Build Add-Ins for Word, Excel, Outlook and...
Yo Office! Use your SPFx Skills to Build Add-Ins for Word, Excel, Outlook and...
BIWUG
 
My Resume_Uday -
My Resume_Uday -My Resume_Uday -
My Resume_Uday -
Uday Kiran
 

Similaire à SPS Paris: Building great client-side web parts with spfx, pnp-js-core, ReactJS and Office UI Fabric (20)

SPUnite17 Building Great Client Side Web Parts with SPFx
SPUnite17 Building Great Client Side Web Parts with SPFxSPUnite17 Building Great Client Side Web Parts with SPFx
SPUnite17 Building Great Client Side Web Parts with SPFx
 
SPUnite17 Become a Developer Hero by Building Office Add ins
SPUnite17 Become a Developer Hero by Building Office Add insSPUnite17 Become a Developer Hero by Building Office Add ins
SPUnite17 Become a Developer Hero by Building Office Add ins
 
Real World SharePoint Framework and Azure Services
Real World SharePoint Framework and Azure ServicesReal World SharePoint Framework and Azure Services
Real World SharePoint Framework and Azure Services
 
Building Responsive Intranet using Sharepoint Framework solutions - Asish Pad...
Building Responsive Intranet using Sharepoint Framework solutions - Asish Pad...Building Responsive Intranet using Sharepoint Framework solutions - Asish Pad...
Building Responsive Intranet using Sharepoint Framework solutions - Asish Pad...
 
Your Intranet, Your Way
Your Intranet, Your WayYour Intranet, Your Way
Your Intranet, Your Way
 
Building share point framework solutions
Building share point framework solutionsBuilding share point framework solutions
Building share point framework solutions
 
ECS19 - Vesa Juvonen - SharePoint and Office 365 Development PowerClass
ECS19 - Vesa Juvonen - SharePoint and Office 365 Development PowerClassECS19 - Vesa Juvonen - SharePoint and Office 365 Development PowerClass
ECS19 - Vesa Juvonen - SharePoint and Office 365 Development PowerClass
 
Yo Office! Use your SPFx Skills to Build Add-Ins for Word, Excel, Outlook and...
Yo Office! Use your SPFx Skills to Build Add-Ins for Word, Excel, Outlook and...Yo Office! Use your SPFx Skills to Build Add-Ins for Word, Excel, Outlook and...
Yo Office! Use your SPFx Skills to Build Add-Ins for Word, Excel, Outlook and...
 
SharePoint Framework -The future of SharePoint/ Office 365 developer ecosystem.
SharePoint Framework -The future of SharePoint/ Office 365 developer ecosystem. SharePoint Framework -The future of SharePoint/ Office 365 developer ecosystem.
SharePoint Framework -The future of SharePoint/ Office 365 developer ecosystem.
 
Rencore Webinar: SharePoint Customizations - the most overlooked road block t...
Rencore Webinar: SharePoint Customizations - the most overlooked road block t...Rencore Webinar: SharePoint Customizations - the most overlooked road block t...
Rencore Webinar: SharePoint Customizations - the most overlooked road block t...
 
Custom Development in SharePoint – What are my options now?
Custom Development in SharePoint – What are my options now?Custom Development in SharePoint – What are my options now?
Custom Development in SharePoint – What are my options now?
 
SPFx- A modern development model for SharePoint
SPFx- A modern development model  for SharePointSPFx- A modern development model  for SharePoint
SPFx- A modern development model for SharePoint
 
My Resume_Uday -
My Resume_Uday -My Resume_Uday -
My Resume_Uday -
 
SPS Monaco 2017 - The Lay of the Land of Client-Side Development circa 2017
SPS Monaco 2017 - The Lay of the Land of Client-Side Development circa 2017SPS Monaco 2017 - The Lay of the Land of Client-Side Development circa 2017
SPS Monaco 2017 - The Lay of the Land of Client-Side Development circa 2017
 
Come riprogettare le attuali farm solution di share point con il nuovo modell...
Come riprogettare le attuali farm solution di share point con il nuovo modell...Come riprogettare le attuali farm solution di share point con il nuovo modell...
Come riprogettare le attuali farm solution di share point con il nuovo modell...
 
Office Add-ins developer community call-January 2020
Office Add-ins developer community call-January 2020Office Add-ins developer community call-January 2020
Office Add-ins developer community call-January 2020
 
How to build a Project Hub with Hubsites and Sitedesign and Sitescripts
How to build a Project Hub with Hubsites and Sitedesign and Sitescripts How to build a Project Hub with Hubsites and Sitedesign and Sitescripts
How to build a Project Hub with Hubsites and Sitedesign and Sitescripts
 
SharePoint Fest Chicago - From SharePoint to Office 365 Development
SharePoint Fest Chicago - From SharePoint to Office 365 DevelopmentSharePoint Fest Chicago - From SharePoint to Office 365 Development
SharePoint Fest Chicago - From SharePoint to Office 365 Development
 
SharePoint Saturday Ottawa - From SharePoint to Office 365 Development
SharePoint Saturday Ottawa - From SharePoint to Office 365 DevelopmentSharePoint Saturday Ottawa - From SharePoint to Office 365 Development
SharePoint Saturday Ottawa - From SharePoint to Office 365 Development
 
ESPC 2016 - From SharePoint to Office 365 Development - The path to your new ...
ESPC 2016 - From SharePoint to Office 365 Development - The path to your new ...ESPC 2016 - From SharePoint to Office 365 Development - The path to your new ...
ESPC 2016 - From SharePoint to Office 365 Development - The path to your new ...
 

Dernier

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Dernier (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 

SPS Paris: Building great client-side web parts with spfx, pnp-js-core, ReactJS and Office UI Fabric

  • 1. Building Great Client-side Web Parts with SPFx, PnP- JS-Core, ReactJS and Office UI Fabric Bill Ayers 14 octobre 2017 #SPSParis
  • 3.
  • 4. Eur Ing Dr Bill Ayers MCM/MCSM Charter SharePoint MVP, MCT, MCTS, MCITP, MCSD, MCAD, MCSA, MCDBA, Professional Scrum Master, etc. etc. Flow Simulation Ltd. www.SPDoctor.net BillA@flosim.com @SPDoctor Consultant specialising in SharePoint and Office 365 Development and Architecture for Collaboration and Mobile Development
  • 5. • SharePoint Development Backstory • The SharePoint Framework • ReactJS • Office UI Fabric • OfficeDev PnP and PnP-JS-Core library • Building an SPFx WebPart • Conclusions Agenda
  • 6. Cloud Hosted Add-ins Remote Web S2S Trust OAuth (O365) SharePoint Web Server Managed CSOM or REST Cross-domain Request Host Web X D
  • 7. • Branding • Add behaviour • Script Editor Web Part • Effective, but many problems SharePoint/Office 365 SharePoint Page SPWeb JavaScript Injection JavaScript Managed CSOM or REST API or MS Graph API
  • 8. Limitations • No deployment or packaging model – DIY • No central control • Master page may change! • Scripting disabled by default for personal sites and self-service sites in SharePoint Online and root site collection • When scripting is disabled… • Links removed from Site Settings page • SharePoint Designer capabilities reduced • Can’t edit master pages or page layouts • Can’t edit theme for current site • Missing Web Parts (e.g. Script Editor, Content Editor) • Can’t upload .aspx files to document libraries • Enable scripting with UI, CSOM or PowerShell
  • 9. Introducing the SharePoint Framework (SPFx) Model for building client-side pages, web parts and more Announced May 4th 2016, now GA! Authoring canvas, no iFrames Command-line-driven open-source toolchain (or community VS extension) Used by SharePoint product team Works in “modern” and “classic” pages Your choice of client-side framework; Angular, React, Knockout, Vanilla.JS ;-) Office 365/SharePoint Online On-premises: SP2016 FP2 (now GA)
  • 10. Modern Site Pages Easily create powerful, beautiful looking pages Modern building blocks Mobile support is built in from the start Pages get better with the Microsoft Graph
  • 11. New SPFx Extension Types Announced at //build/ 2017 • ApplicationCustomizers allow developers to add script to the page, as well as access well-known HTML element placeholders and extend them with custom renderings • FieldCustomizers can be used to provide modified views to data for fields within a list • CommandSets let developers extend the command surfaces of SharePoint to add new actions, along with client-side code that can be used to implement behaviours • Web Part Connections enable more connected web parts that can work together to share information • Communication Sites (announced at #SPSummit)
  • 12. Wait, did you say “Command-line-driven open-source toolchain” ?
  • 13. Things You Need… • Node.js (LTS version) • Gulp • Yeoman • Git • Editor (e.g. VS Code) • Yeoman generator for SharePoint Framework • Technologies like WebPack, SASS and other libraries will be installed by Node’s package manager - NPM …or use Visual Studio extension: https://github.com/SharePoint/sp-dev-fx-vs-extension
  • 14. • Features of next version(s) of JavaScript/ECMAScript standard • Compiles to JavaScript (ES5) • Strong typing, classes • Original design goal was to make JavaScript easier for C# developers • Makes it easier to write production quality JavaScript • Good support in VS Code • Development language for the base templates in SharePoint Framework https://www.typescriptlang.org/
  • 15. ReactJS • Backed by Facebook and Instagram • Component design (composition) • Very fast Virtual DOM page rendering model • Provides the view engine only • JSX format takes some getting used to  • TypeScript Compiler has support for JSX (TSX) • Used by Microsoft • ReactJS tutorial: https://zapier.com/engineering/react-js-tutorial-guide- gotchas/ or https://facebook.github.io/react/ var button = <Button>Hello, world!</Button>;
  • 16. Office UI Fabric • Responsive framework (kind-of) • Office Design Language for web • Designed for Office Add-ins by OneDrive and SharePoint Design Studio • Consistent look-and-feel with Office • “Modern”, not “classic” SharePoint CSS • About 100k, 200k with components • Available as raw CSS or versions for Angular and React • Dev.office.com/fabric
  • 17. Office UI Fabric • Design elements to give add-ins the same look and feel as the rest of the Office suite • Consistent typography, icons and behaviour Link to UI Fabric Stylesheets: <link rel="stylesheet" href="https://appsforoffice.microsoft.com/fabric/1.2.0/fabric.min.css"> <link rel="stylesheet" href="https://appsforoffice.microsoft.com/fabric/1.2.0/fabric.components.min.css"> Decorate elements with UI Fabric classes: <button class="ms-Button" id="get-data-from-selection"> <span class="ms-Button-icon"><em class="ms-Icon ms-Icon--plus"></em></span> <span class="ms-Button-label">Get Data from selection</span> <span class="ms-Button-description">Get Data from the document selection</span> </button> http://dev.office.com/fabric Link to UI Fabric JS: <script src="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-js/1.2.0/js/fabric.min.js"></script>
  • 18. Office UI Fabric ReactJS Components • 30 re-useable React components, ready to use • Used by Microsoft to build Office and SharePoint • Angular? See ngOfficeUIFabric import Button from 'office-ui-fabric-react'; Var b = <Button onClick={() => this.getData() } className="ms-Button--primary"> Refresh List</Button> Breadcrumb Button Callout Checkbox ChoiceGroup ColorPicker CommandBar ContextualMenu DatePicker DetailsList Dialog DocumentCard Dropdown Facepile GroupedList Image Label Layer Link List MessageBar Nav Overlay Panel Persona Pickers PeoplePicker Pivot ProgressIndicator SearchBox Slider Spinner TextField Toggle
  • 19. OfficeDev PnP Initiative • PnP-JS-Core • Still under development • JavaScript wrapper for SharePoint REST APIs • Good fit for SPFx development • Github.com/SharePoint/PnP-JS-Core • “Home” of SPFx guidance, documentation, samples, etc. • Dev.Office.com/SharePoint is starting point • Code hosted on GitHub
  • 20. Looking at ReactJS Looking at Office UI Fabric Looking at OfficeDev PnP-JS-Core Building an SPFx WebPart
  • 21. Conclusions • “Modern” SharePoint development tools are your choice • The “old” stuff still works • Build re-usable components with ReactJS • PnP-JS-Core makes SharePoint REST easy • Office-UI-Fabric makes web parts beautiful • We are on a journey – join us!
  • 22. Resources: • http://dev.office.com/SharePoint • http://dev.office.com/fabric • https://facebook.github.io/react/ • https://github.com/SharePoint/PnP-JS-Core • https://github.com/OfficeDev/TrainingContent/SharePoint • http://github.com/SPDoctor/SPFXShoppingList Bingle
  • 23.
  • 24. Thank you, for your for #SPSParis