Cheatography
https://cheatography.com
A quick guide to learn how to work with SharePoint framework asap.
This is a draft cheat sheet. It is a work in progress and is not finished yet.
Download & Install Requirements
Visual Studio Code |
|
NodeJs |
|
Gulp, Yeoman & Yeoman SharePoint Generator |
execute npm install gulp-cli yo @microsoft/generator-sharepoint --global
in command prompt` |
Creating a Solution
Create project |
yo @microsoft/sharepoint
inside desired folder |
Deploying a Solution
Bundle solution. This will generate the scripts required to run the webpart on the site. |
|
Package solution. This will create a .sppkg file in your sharepoint folder that can be added to the appcatalog. |
Gulp package-solution --ship
|
Updating a Solution
View outdated packages |
|
Install specific package versions |
npm install [package-name]@[version-number]
e.g. npm install express@4.16.1
|
|
npm install -g @pnp/cli-microsoft365
then m365 spfx project upgrade --toVersion [version]
|
|
|
Working with the solution
Trust the development SSL certificate included in the toolchain |
gulp trust-dev-cert
(only once inside root folder of project) |
Start the local web server & launch the hosted workbench |
|
Open solution in specific tenant (site) |
Browse to https://<your-SharePoint-site>/_layouts/workbench.aspx
and add webparts |
Install packages |
npm install @<package>
e.g. npm install @pnp/sp @pnp/graph --save
|
Import packages into solution |
import { SPFI, SPFx } from "@pnp/sp";
(inside file) |
Clean solution (clear the temporary folders and files created in the solution. Some of the folders cleaned up during the process are temp, dist) |
|
Build solution (compiles the code and creates the necessary temporary files and folders) |
|
|
|
Handy Packages
|
npm install -g @pnp/cli-microsoft365
|
Helps with problems and updates |
|
npm i @microsoft/applicationinsights-react-js @microsoft/applicationinsights-web
|
Find out about the performance and usage of your web page or app |
|
npm install react-localization
|
Gives you full control over which language is being selected |
|
|
Rich text editing |
|
npm install @pnp/sp @pnp/graph --save
|
Easy and intuitive consuming of SharePoint, Graph, and Office 365 REST APIs |
|
npm install @pnp/spfx-controls-react --save --save-exact
|
Easy access to handy react controls |
|
|
Responsive layout |
|
|
Start spfx solution with older version, e.g. npx -p yo -p @microsoft/generator-sharepoint@1.12.1 yo @microsoft/sharepoint
|
|