Introduction to SharePoint Framework (SPFx)

FabioFranzini 2,081 views 24 slides Oct 02, 2017
Slide 1
Slide 1 of 24
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24

About This Presentation

Slides of my session @ SPSMilan 2017


Slide Content

Introduction to SharePoint Framework ( SPFx ) Fabio Franzini - Office Servers & Services MVP @franzinifabio fabiofranzini.com

Agenda Introducing SharePoint Framework ( SPFx ) SPFx Toolchain SPFx Webpart Deploy SPFx WebPart Q&A

Introducing SharePoint Framework

SharePoint – Evolving across versions 2013 APP/ADD-IN MODEL 2010 SANDBOX & CSOM <= 2007 FULL TRUST 2016 CLOUD FRIENDLY SPFx

WHAT IS THE SPFx ? Is a page and web part model with full support for client-side SharePoint development using modern web technology and tools Runs in the context of the current user and connection in the browser The controls are rendered in the normal page DOM, NO iFrames ! The controls are responsive and accessible by nature It's framework agnostic The toolchain is based on common open source client development tools Component types: Client Web Part Extensions Application Customizer Field Customizer Command Sets SPFx web parts can be added to both classic and modern pages Available in the Cloud and On- Prem (SP 2016 Feature Pack 2)

SPFx principles New/Modern toolchain Client-side rendering No iFrame needed No JavaScript Injection needed No server side-code needed IDE/Development platform agnostic

SPFx Toolchain

TOOLCHAIN COMPARISON IIS Express VS Project  New  <Template> C# MS Build

SPFx DEVELOPMENT ENVIRONMENT Use any most OS / workstation Office 365 / SharePoint Online tenant App catalog for deployment Install nodeJS (current Long Term Support (LTS) version) Yeoman and Gulp C:\> npm i –g yo gulp SPFx Yeoman generator C:\> npm i –g @microsoft/generator-sharepoint C:\> npm update –g @microsoft/generator-sharepoint Generate local Trust Cert C:\> gulp trust-dev-cert Use code editor VS Code / Sublime Text / NotePad++, etc

SPFx Webpart

CREATE YOUR FIRST SPFx WEBPART C:\> md helloworld-webpart C:\> cd helloworld-webpart C:\> yo @ microsoft / sharepoint Working on it…  You can execute yo command again to add more webparts to project C:\> gulp serve Check out your first WebPart ! May also load in SPO workbench: “../_layouts/15/workbench.aspx”

SPFx PROJECT FOLDER OVERVIEW Get to know your Webpart folder structure src : primary webpart TypeScript source code config : json configuration files for build process typings : TypeScript typings for JS libs – legacy lib : Build files (TS compiled JS) ready for bundle dist : Final web ready code for distribution sharepoint : . spapp file for App Catalog node_modules : NodeJS modules (JS) for toolchain

Deploy SPFx WebPart

PACKAGE YOUR WEBPART FOR DEPLOYMENT Set deployment configuration config/package-solution.json – general settings and package name write-manifests.json – CDN / bundle location – for dev, can serve locally: gulp serve --nobrowser C:\> gulp clean (cleans sharepoint and temp folders) C:\> gulp build (Rebuilds the solution) C:\> gulp bundle (Creates the solution bundles) C:\> gulp package-solution (Creates /sharepoint/”webpart”.spapp) C:\> gulp –ship (minifies bundle and reads in CDN info from config/write-manifests.json) C:\> gulp package-solution --ship (Recreates /sharepoint/”webpart”.spapp with CDN info)

PACKAGE YOUR WEBPART FOR DEPLOYMENT After solution created, can then add to SharePoint Add . spapp to app catalog Add Add-In to SharePoint site Add WebPart in site to content page Configure CDN Office 365 CDN : https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/hosting-webpart-from-office-365-cdn Azure CDN : https://dev.office.com/sharepoint/docs/spfx/web-parts/get-started/deploy-web-part-to-cdn Or manually deploy solution bundle and config write- manifests.json