SlideShare a Scribd company logo
Spunite17 Converting your CEWP Customisations
SPFx Mark Rackley
mrackley@paitgroup.com
Converting Your CEWP Customizations to the
SharePoint Framework
© 2015 PAIT Group
Mark Rackley / Partner & CSO
• 20+ years software
architecture and
development experience
• Office 365 MVP, SharePoint
Junkie since 2007
• Event Organizer
(SharePointalooza.org)
• Blogger, Writer, Speaker
• Bacon aficionado
@mrackley
www.MarkRackley.net
www.PAITGroup.com
www.SharePointaLooza.org
www.StratusForms.com
#SayNoToInfoPath
© 2015 PAIT Group
WHAT’S UP WITH THIS SESSION?
© 2015 PAIT Group
WHAT’S UP WITH THIS SESSION?
Have existing jQuery/JavaScript solutions
Need to better understand the SharePoint Framework
Don’t know or don’t want to learn TypeScript
Don’t know or don’t want to learn React
Need to know how to get started
FOR CLIENT SIDE DEVELOPERS THAT…
© 2015 PAIT Group
Goals for the Session
What is the
SharePoint
Framework?
Why do we
need the
SharePoint
Framework?
Converting a
Customization to
the SharePoint
Framework
© 2015 PAIT Group
WHAT IS THE SHAREPOINT FRAMEWORK (SPFx)
SharePoint framework
LOB Systems and Cloud Services
Microsoft Graph
(coming soon)
Modern client-side development
Lightweight web and mobile
Used to build Modern SharePoint Page
Backward compatible
Supports open source tools
and JavaScript web frameworks
© 2015 PAIT Group
THE SHAREPOINT FRAMEWORK
Finally! A management and deployment story for our client side web parts
Works in Classic and Modern Pages
Users can set properties instead of having to modify script
Local Workbench for development and debugging
TypeScript (if you are a .NET Dev)
You GET to learn new (marketable) skills
Mobile friendly
Works the same in On Premises and Online
GOOD
© 2015 PAIT Group
THE SHAREPOINT FRAMEWORK
The process can initially be daunting if you are a .NET developer (Change is hard)
TypeScript (If you are JavaScript developer)
Lack of Visual Studio Tooling
There is no store
You HAVE to learn new skills
WHAT HURDLES WILL YOU FACE?
© 2015 PAIT Group
JavaScript/HTML/CSS
An open mind (it’s a brave new world)
Node.js, NPM, Yeoman, Gulp??? (open source
FTW!)
TypeScript (Enterprise JavaScript
Development)
Office UI Fabric (Front-end visual Framework)
VisualStudio Code
SKILLS YOU NEED TO
EMBRACE
© 2015 PAIT Group
WHY DO YOU NEED THE SHAREPOINT
FRAMEWORK
© 2015 PAIT Group
WHY DO YOU NEED THE SHAREPOINT
FRAMEWORK
Stop polluting the global namespace
Better for the mobile application
Prevents non-devs from potential security
risks of putting unknown scripts on page
STOP SCRIPT INJECTION
© 2015 PAIT Group
WHY DO YOU NEED THE SHAREPOINT
FRAMEWORK
Stop polluting the global namespace
Better for the mobile framework
Prevents non-devs from potential security
risks of putting unknown scripts on page
STOP SCRIPT INJECTION
Create manageable projects for multiple devs
Deploy solutions easily to multiple sites or
pages
Use properties and keep users out of scripts
ENTERPRISE READY
DEMO: A CUSTOMIZATION WITHOUT THE SHAREPOINT
FRAMEWORK
DEMO: CONVERTING A CUSTOMIZATION TO THE
SHAREPOINT FRAMEWORK
SOURCE CODE:
HTTPS://GITHUB.COM/MRACKLEY/IGNITE2017
© 2015 PAIT Group
The Steps we walked through in the demo
1. Copy scripts and css files to your SPFx project
2. Add references to external scripts to Config.json
3. Import and add appropriate changes to the main .ts file
4. Take advantage of Properties to make your solution
configurable by the users
5. Package and deploy your solution
© 2015 PAIT Group
1. Copy script files to your SPFx project
• Copy your .js and your .css files to
/src/webparts/webPartName folder
• (Optional) Copy our third party files to the same location if
you do not wish to reference them via CDN.
© 2015 PAIT Group
2. Add references to Config.json
• Add to externals section of Config.json
• Add path to library
• Add globalName if other libraries are dependent
• Indicate globalDependies
© 2015 PAIT Group
2. Add references to Config.json
"jquery": {
"path": "https://code.jquery.com/jquery-1.12.4.min.js",
"globalName": "jQuery"
},
"flip": {
"path": "https://cdn.rawgit.com/nnattawat/flip/master/dist/jquery.flip.min.js",
"globalName": "jQuery",
"globalDependencies": ["jquery"]
}
© 2015 PAIT Group
3. Make changes to main.ts
Import externals
Add external css
Add local .js and .css files
Use the pageContext object instead of
_spPageContextInfo
© 2015 PAIT Group
Import externals
import 'jquery';
import 'flip';
declare var $;
© 2015 PAIT Group
Add external css
import {SPComponentLoader} from '@microsoft/sp-loader';
SPComponentLoader.loadCss("<url to css file>");
© 2015 PAIT Group
Add local .js and .css files
require('./PAITGroup.PromotedLinks.js');
require('./PAITGroup.PromotedLinks.css');
require('./masonry.pkgd.min.js');
© 2015 PAIT Group
Use the pageContext object
this.context.pageContext.site.absoluteUrl
© 2015 PAIT Group
4. Take advantage of properties
For the interface
/src/webparts/<project>/<project>WebPartPartProps.ts
For the labels in the property panel
/src/webparts/<project>/loc/en-us.js
/src/webparts/<projct>/mystrings.d.ts
For default values
/src/webparts/<project>/<project>WebPart.manifest.json
To create the property panel
/src/webparts/<project>/<project>WebPart.ts
A COUPLE OF OTHER POTENTIAL HURDLES
© 2015 PAIT Group
Use REST to get the Form Digest if needed
var getDigestCall =
$.ajax({
url: <site url> + '/_api/contextinfo',
method: "POST",
headers: { "Accept": "application/json; odata=verbose" }
})
data.d.GetContextWebInformation.FormDigestValue
© 2015 PAIT Group
Disable reactive property changes
protected get disableReactivePropertyChanges(): boolean {
return true;
}
© 2015 PAIT Group
5. Package and deploy your solution
• Update “cdnBasePath” in writes-manifest.json
• gulp bundle –ship
• gulp package-solution –ship
• Upload files in /temp/deploy to CDN location
• Upload app package at /sharepoint/solution to app catalog
Deploy your SharePoint client-side web part to a Azure Storage
account
https://dev.office.com/sharepoint/docs/spfx/web-parts/get-
started/deploy-web-part-to-cdn
Thank you
http://www.paitgroup.com
http://www.markrackley.net
mrackley@paitgroup.com
@mrackley
© 2016 PAIT Group http://www.PAITGroup.com December 14,2016

More Related Content

PDF
SPUnite17 Building Great Client Side Web Parts with SPFx
PDF
SPUnite17 Introduction to the Office Dev PnP Core Libraries
PDF
SPUnite17 Timer Jobs Event Handlers
PDF
SPUnite17 SPFx Extensions
PDF
ECS19 - Bill Ayers - UNLOCK YOUR BUSINESS KNOWLEDGE WITH THE MICROSOFT GRAPH,...
PPTX
APIs, APIs Everywhere!
 
PPTX
ECS19 - Mike Ammerlaan - The Microsoft 365 Platform: A Developer’s Tour
PPTX
Chris O'Brien - Introduction to the SharePoint Framework for developers
SPUnite17 Building Great Client Side Web Parts with SPFx
SPUnite17 Introduction to the Office Dev PnP Core Libraries
SPUnite17 Timer Jobs Event Handlers
SPUnite17 SPFx Extensions
ECS19 - Bill Ayers - UNLOCK YOUR BUSINESS KNOWLEDGE WITH THE MICROSOFT GRAPH,...
APIs, APIs Everywhere!
 
ECS19 - Mike Ammerlaan - The Microsoft 365 Platform: A Developer’s Tour
Chris O'Brien - Introduction to the SharePoint Framework for developers

What's hot (20)

PDF
Practical management of development & QA environments for SharePoint 2013
PDF
SPUnite17 TypeScript for SharePoint Developers
PPTX
Microsoft Teams as a Development Platform
PDF
O365Con18 - Customizing SharePoint and Microsoft Teams with SharePoint Framew...
PDF
O365Con18 - New Era of Customizing - Olli Jaaskelainen
PPTX
ECS19 - Vesa Juvonen - SharePoint Development for Enterprises - What's New an...
PPTX
Azure Web Jobs
PDF
O365Con18 - Site Templates, Site Life Cycle Management and Modern SharePoint ...
PPTX
Introduction to SharePoint Framework (SPFx)
PPTX
[Jansen] Transforming your classic team sites into modern group connected tea...
PPTX
Introduction to Office 365 PnP- Reusable solutions
PPTX
Improving the SharePoint Development Process with Continuous Integration
PDF
O365Con18 - Best Practice with Company Video on Microsoft Stream - Michael Greth
PPTX
ECS19 - Vesa Juvonen - Getting Started With SharePoint Framework - Roadmap
PDF
Developing with SharePoint Framework (SPFx) on-premises
PPTX
An Introduction to the Office 365 Patterns and Practices Project
PPTX
Get started with building native mobile apps interacting with SharePoint
PPTX
CDNs para el SharePoint Framework (SPFx)
PPTX
Getting Started with SharePoint Development
PDF
O365Con18 - Hybrid SharePoint Deep Dive - Thomas Vochten
Practical management of development & QA environments for SharePoint 2013
SPUnite17 TypeScript for SharePoint Developers
Microsoft Teams as a Development Platform
O365Con18 - Customizing SharePoint and Microsoft Teams with SharePoint Framew...
O365Con18 - New Era of Customizing - Olli Jaaskelainen
ECS19 - Vesa Juvonen - SharePoint Development for Enterprises - What's New an...
Azure Web Jobs
O365Con18 - Site Templates, Site Life Cycle Management and Modern SharePoint ...
Introduction to SharePoint Framework (SPFx)
[Jansen] Transforming your classic team sites into modern group connected tea...
Introduction to Office 365 PnP- Reusable solutions
Improving the SharePoint Development Process with Continuous Integration
O365Con18 - Best Practice with Company Video on Microsoft Stream - Michael Greth
ECS19 - Vesa Juvonen - Getting Started With SharePoint Framework - Roadmap
Developing with SharePoint Framework (SPFx) on-premises
An Introduction to the Office 365 Patterns and Practices Project
Get started with building native mobile apps interacting with SharePoint
CDNs para el SharePoint Framework (SPFx)
Getting Started with SharePoint Development
O365Con18 - Hybrid SharePoint Deep Dive - Thomas Vochten
Ad

Viewers also liked (14)

PDF
SPUnite17 5 More Query Rules
PDF
SPUnite17 SharePoint and Data Loss Prevention
PDF
SPUnite17 Deep Dive Building Solutions
PDF
SPUnite17 Getting Notified by SharePoint with WebHooks
PDF
SPUnite17 Making Sense of the SharePoint Framework
PDF
SpUnite17 Exploring Identity Management Options in Office 365
PDF
SPUnite17 Getting up to Speed with React
PDF
SPUnite17 Successful SharePoint Projects and User eXperience
PDF
SPUnite17 Who Are You and What Do You Want
PDF
SPUnite17 Modern NewsPublishing with SharePoint
PDF
SPUnite17 Large Lists in SharePoint
PDF
SPUnite17 Migrating your Customizations from On-prem to SharePoint Online
PDF
SPUnite17 Introducing Logic Apps
PDF
SPUnite17 External Sharing in SharePoint Online
SPUnite17 5 More Query Rules
SPUnite17 SharePoint and Data Loss Prevention
SPUnite17 Deep Dive Building Solutions
SPUnite17 Getting Notified by SharePoint with WebHooks
SPUnite17 Making Sense of the SharePoint Framework
SpUnite17 Exploring Identity Management Options in Office 365
SPUnite17 Getting up to Speed with React
SPUnite17 Successful SharePoint Projects and User eXperience
SPUnite17 Who Are You and What Do You Want
SPUnite17 Modern NewsPublishing with SharePoint
SPUnite17 Large Lists in SharePoint
SPUnite17 Migrating your Customizations from On-prem to SharePoint Online
SPUnite17 Introducing Logic Apps
SPUnite17 External Sharing in SharePoint Online
Ad

Similar to Spunite17 Converting your CEWP Customisations (20)

PPTX
Utilizing jQuery in SharePoint: Get More Done Faster
PDF
Convert your Full Trust Solutions to the SharePoint Framework (SPFx)
PDF
How to convert your Full Trust Solutions to the SharePoint Framework (SPFx)
PPTX
Convert your Full Trust Solutions to the SharePoint Framework (SPFx) in 1 hour
PDF
How to convert your Full Trust Solutions to the SharePoint Framework (SPFx)
PPTX
Que hay de nuevo en Visual Studio 2013 y ASP.NET 5.1
PDF
Real World SharePoint Framework and Azure Services
PPTX
Overview and Walkthrough of the Application Programming Model with SAP Cloud ...
PPTX
The art of .net deployment automation
PPTX
ASP.NET 5: What's the Big Deal
PDF
How You Convince Your Manager To Adopt Scala.js in Production
PPTX
Django app deployment in Azure By Saurabh Agarwal
PPT
CVCC - Data Visualization and VisiFire
PPTX
Extending SAP SuccessFactors in the Cloud and how not to do it
PPTX
SharePoint Conference North America - Converting your JavaScript to SPFX
POTX
Hands-on Workshop: Intermediate Development with Heroku and Force.com
PDF
Convert your Full Trust Solutions to the SharePoint Framework (SPFx)
PDF
Spsnyc transforming share point farm solutions to the add-in model and shar...
 
PDF
HP Helion European Webinar Series ,Webinar #3
PDF
Laravel CI / CD in Azure Web Apps - Global Azure Bootcamp Jakarta
Utilizing jQuery in SharePoint: Get More Done Faster
Convert your Full Trust Solutions to the SharePoint Framework (SPFx)
How to convert your Full Trust Solutions to the SharePoint Framework (SPFx)
Convert your Full Trust Solutions to the SharePoint Framework (SPFx) in 1 hour
How to convert your Full Trust Solutions to the SharePoint Framework (SPFx)
Que hay de nuevo en Visual Studio 2013 y ASP.NET 5.1
Real World SharePoint Framework and Azure Services
Overview and Walkthrough of the Application Programming Model with SAP Cloud ...
The art of .net deployment automation
ASP.NET 5: What's the Big Deal
How You Convince Your Manager To Adopt Scala.js in Production
Django app deployment in Azure By Saurabh Agarwal
CVCC - Data Visualization and VisiFire
Extending SAP SuccessFactors in the Cloud and how not to do it
SharePoint Conference North America - Converting your JavaScript to SPFX
Hands-on Workshop: Intermediate Development with Heroku and Force.com
Convert your Full Trust Solutions to the SharePoint Framework (SPFx)
Spsnyc transforming share point farm solutions to the add-in model and shar...
 
HP Helion European Webinar Series ,Webinar #3
Laravel CI / CD in Azure Web Apps - Global Azure Bootcamp Jakarta

More from NCCOMMS (20)

PDF
O365Con19 - UI:UX 101 Learn How to Design Custom Experiences for SharePoint -...
PDF
O365Con19 - Model-driven Apps or Canvas Apps? - Rick Bakker
PDF
O365Con19 - Office 365 Groups Surviving the Real World - Jasper Oosterveld
PDF
O365Con19 - Developing Timerjob and Eventhandler Equivalents - Adis Jugo
PDF
O365Con19 - Sharepoint with (Artificial) Intelligence - Adis Jugo
PDF
O365Con19 - What Do You Mean 90 days Isn't Enough - Paul Hunt
PDF
O365Con19 - Tips and Tricks for Complex Migrations to SharePoint Online - And...
PDF
O365Con19 - Start Developing Teams Tabs and SharePoint Webparts with SPFX - O...
PDF
O365Con19 - Start Your Journey from Skype for Business to Teams - Sasja Beere...
PDF
O365Con19 - Lets Get Started with Azure Container Instances - Jussi Roine
PDF
O365Con19 - Azure Blackbelt - Jussi Roine
PDF
O365Con19 - Customise the UI in Modern SharePoint Workspaces - Corinna Lins
PDF
O365Con19 - Be The Protagonist of Your Modern Workplace - Corinna Lins
PDF
O365Con19 - How to Really Manage all your Tasks Across Microsoft 365 - Luise ...
PDF
O365Con19 - Sharing Code Efficiently in your Organisation - Elio Struyf
PDF
O365Con19 - Things I've Learned While Building a Product on SharePoint Modern...
PDF
O365Con19 - Keep Control of Your Data with AIP and CA - Bram de Jager
PDF
O365Con19 - Kaizala a Dive Into the Unknown - Rick van Rousselt
PDF
O365Con19 - How to Inspire Users to Unstick from Email - Luise Freese
PDF
O365Con19 - O365 Identity Management and The Golden Config - Chris Goosen
O365Con19 - UI:UX 101 Learn How to Design Custom Experiences for SharePoint -...
O365Con19 - Model-driven Apps or Canvas Apps? - Rick Bakker
O365Con19 - Office 365 Groups Surviving the Real World - Jasper Oosterveld
O365Con19 - Developing Timerjob and Eventhandler Equivalents - Adis Jugo
O365Con19 - Sharepoint with (Artificial) Intelligence - Adis Jugo
O365Con19 - What Do You Mean 90 days Isn't Enough - Paul Hunt
O365Con19 - Tips and Tricks for Complex Migrations to SharePoint Online - And...
O365Con19 - Start Developing Teams Tabs and SharePoint Webparts with SPFX - O...
O365Con19 - Start Your Journey from Skype for Business to Teams - Sasja Beere...
O365Con19 - Lets Get Started with Azure Container Instances - Jussi Roine
O365Con19 - Azure Blackbelt - Jussi Roine
O365Con19 - Customise the UI in Modern SharePoint Workspaces - Corinna Lins
O365Con19 - Be The Protagonist of Your Modern Workplace - Corinna Lins
O365Con19 - How to Really Manage all your Tasks Across Microsoft 365 - Luise ...
O365Con19 - Sharing Code Efficiently in your Organisation - Elio Struyf
O365Con19 - Things I've Learned While Building a Product on SharePoint Modern...
O365Con19 - Keep Control of Your Data with AIP and CA - Bram de Jager
O365Con19 - Kaizala a Dive Into the Unknown - Rick van Rousselt
O365Con19 - How to Inspire Users to Unstick from Email - Luise Freese
O365Con19 - O365 Identity Management and The Golden Config - Chris Goosen

Recently uploaded (20)

PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
 
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Cloud computing and distributed systems.
PPTX
Big Data Technologies - Introduction.pptx
PDF
Empathic Computing: Creating Shared Understanding
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
 
PPTX
A Presentation on Artificial Intelligence
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPT
Teaching material agriculture food technology
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
cuic standard and advanced reporting.pdf
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
CIFDAQ's Market Insight: SEC Turns Pro Crypto
 
Network Security Unit 5.pdf for BCA BBA.
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
20250228 LYD VKU AI Blended-Learning.pptx
Cloud computing and distributed systems.
Big Data Technologies - Introduction.pptx
Empathic Computing: Creating Shared Understanding
Reach Out and Touch Someone: Haptics and Empathic Computing
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
 
A Presentation on Artificial Intelligence
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
NewMind AI Weekly Chronicles - August'25 Week I
Teaching material agriculture food technology
Unlocking AI with Model Context Protocol (MCP)
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
cuic standard and advanced reporting.pdf

Spunite17 Converting your CEWP Customisations

  • 2. SPFx Mark Rackley mrackley@paitgroup.com Converting Your CEWP Customizations to the SharePoint Framework
  • 3. © 2015 PAIT Group Mark Rackley / Partner & CSO • 20+ years software architecture and development experience • Office 365 MVP, SharePoint Junkie since 2007 • Event Organizer (SharePointalooza.org) • Blogger, Writer, Speaker • Bacon aficionado @mrackley www.MarkRackley.net www.PAITGroup.com www.SharePointaLooza.org www.StratusForms.com #SayNoToInfoPath
  • 4. © 2015 PAIT Group WHAT’S UP WITH THIS SESSION?
  • 5. © 2015 PAIT Group WHAT’S UP WITH THIS SESSION? Have existing jQuery/JavaScript solutions Need to better understand the SharePoint Framework Don’t know or don’t want to learn TypeScript Don’t know or don’t want to learn React Need to know how to get started FOR CLIENT SIDE DEVELOPERS THAT…
  • 6. © 2015 PAIT Group Goals for the Session What is the SharePoint Framework? Why do we need the SharePoint Framework? Converting a Customization to the SharePoint Framework
  • 7. © 2015 PAIT Group WHAT IS THE SHAREPOINT FRAMEWORK (SPFx) SharePoint framework LOB Systems and Cloud Services Microsoft Graph (coming soon) Modern client-side development Lightweight web and mobile Used to build Modern SharePoint Page Backward compatible Supports open source tools and JavaScript web frameworks
  • 8. © 2015 PAIT Group THE SHAREPOINT FRAMEWORK Finally! A management and deployment story for our client side web parts Works in Classic and Modern Pages Users can set properties instead of having to modify script Local Workbench for development and debugging TypeScript (if you are a .NET Dev) You GET to learn new (marketable) skills Mobile friendly Works the same in On Premises and Online GOOD
  • 9. © 2015 PAIT Group THE SHAREPOINT FRAMEWORK The process can initially be daunting if you are a .NET developer (Change is hard) TypeScript (If you are JavaScript developer) Lack of Visual Studio Tooling There is no store You HAVE to learn new skills WHAT HURDLES WILL YOU FACE?
  • 10. © 2015 PAIT Group JavaScript/HTML/CSS An open mind (it’s a brave new world) Node.js, NPM, Yeoman, Gulp??? (open source FTW!) TypeScript (Enterprise JavaScript Development) Office UI Fabric (Front-end visual Framework) VisualStudio Code SKILLS YOU NEED TO EMBRACE
  • 11. © 2015 PAIT Group WHY DO YOU NEED THE SHAREPOINT FRAMEWORK
  • 12. © 2015 PAIT Group WHY DO YOU NEED THE SHAREPOINT FRAMEWORK Stop polluting the global namespace Better for the mobile application Prevents non-devs from potential security risks of putting unknown scripts on page STOP SCRIPT INJECTION
  • 13. © 2015 PAIT Group WHY DO YOU NEED THE SHAREPOINT FRAMEWORK Stop polluting the global namespace Better for the mobile framework Prevents non-devs from potential security risks of putting unknown scripts on page STOP SCRIPT INJECTION Create manageable projects for multiple devs Deploy solutions easily to multiple sites or pages Use properties and keep users out of scripts ENTERPRISE READY
  • 14. DEMO: A CUSTOMIZATION WITHOUT THE SHAREPOINT FRAMEWORK
  • 15. DEMO: CONVERTING A CUSTOMIZATION TO THE SHAREPOINT FRAMEWORK SOURCE CODE: HTTPS://GITHUB.COM/MRACKLEY/IGNITE2017
  • 16. © 2015 PAIT Group The Steps we walked through in the demo 1. Copy scripts and css files to your SPFx project 2. Add references to external scripts to Config.json 3. Import and add appropriate changes to the main .ts file 4. Take advantage of Properties to make your solution configurable by the users 5. Package and deploy your solution
  • 17. © 2015 PAIT Group 1. Copy script files to your SPFx project • Copy your .js and your .css files to /src/webparts/webPartName folder • (Optional) Copy our third party files to the same location if you do not wish to reference them via CDN.
  • 18. © 2015 PAIT Group 2. Add references to Config.json • Add to externals section of Config.json • Add path to library • Add globalName if other libraries are dependent • Indicate globalDependies
  • 19. © 2015 PAIT Group 2. Add references to Config.json "jquery": { "path": "https://code.jquery.com/jquery-1.12.4.min.js", "globalName": "jQuery" }, "flip": { "path": "https://cdn.rawgit.com/nnattawat/flip/master/dist/jquery.flip.min.js", "globalName": "jQuery", "globalDependencies": ["jquery"] }
  • 20. © 2015 PAIT Group 3. Make changes to main.ts Import externals Add external css Add local .js and .css files Use the pageContext object instead of _spPageContextInfo
  • 21. © 2015 PAIT Group Import externals import 'jquery'; import 'flip'; declare var $;
  • 22. © 2015 PAIT Group Add external css import {SPComponentLoader} from '@microsoft/sp-loader'; SPComponentLoader.loadCss("<url to css file>");
  • 23. © 2015 PAIT Group Add local .js and .css files require('./PAITGroup.PromotedLinks.js'); require('./PAITGroup.PromotedLinks.css'); require('./masonry.pkgd.min.js');
  • 24. © 2015 PAIT Group Use the pageContext object this.context.pageContext.site.absoluteUrl
  • 25. © 2015 PAIT Group 4. Take advantage of properties For the interface /src/webparts/<project>/<project>WebPartPartProps.ts For the labels in the property panel /src/webparts/<project>/loc/en-us.js /src/webparts/<projct>/mystrings.d.ts For default values /src/webparts/<project>/<project>WebPart.manifest.json To create the property panel /src/webparts/<project>/<project>WebPart.ts
  • 26. A COUPLE OF OTHER POTENTIAL HURDLES
  • 27. © 2015 PAIT Group Use REST to get the Form Digest if needed var getDigestCall = $.ajax({ url: <site url> + '/_api/contextinfo', method: "POST", headers: { "Accept": "application/json; odata=verbose" } }) data.d.GetContextWebInformation.FormDigestValue
  • 28. © 2015 PAIT Group Disable reactive property changes protected get disableReactivePropertyChanges(): boolean { return true; }
  • 29. © 2015 PAIT Group 5. Package and deploy your solution • Update “cdnBasePath” in writes-manifest.json • gulp bundle –ship • gulp package-solution –ship • Upload files in /temp/deploy to CDN location • Upload app package at /sharepoint/solution to app catalog Deploy your SharePoint client-side web part to a Azure Storage account https://dev.office.com/sharepoint/docs/spfx/web-parts/get- started/deploy-web-part-to-cdn