Creating Modern Site Templates Using Site Designs · 2020-05-08 · SharePoint Online Storage Queue...
Transcript of Creating Modern Site Templates Using Site Designs · 2020-05-08 · SharePoint Online Storage Queue...
![Page 1: Creating Modern Site Templates Using Site Designs · 2020-05-08 · SharePoint Online Storage Queue Azure Function Microsoft Flow Site URL is used as a parameter to connect to site](https://reader033.fdocuments.us/reader033/viewer/2022043010/5f9ea09717c943275e7cac85/html5/thumbnails/1.jpg)
![Page 2: Creating Modern Site Templates Using Site Designs · 2020-05-08 · SharePoint Online Storage Queue Azure Function Microsoft Flow Site URL is used as a parameter to connect to site](https://reader033.fdocuments.us/reader033/viewer/2022043010/5f9ea09717c943275e7cac85/html5/thumbnails/2.jpg)
Todd Klindt
• 14 Year SharePoint MVP
• Writer, speaker, podcaster, consultant at Sympraxis Consulting, SysKit Chief Evangelist
@toddklindt
www.toddklindt.com
www.toddklindt.com/SPSNashville
![Page 3: Creating Modern Site Templates Using Site Designs · 2020-05-08 · SharePoint Online Storage Queue Azure Function Microsoft Flow Site URL is used as a parameter to connect to site](https://reader033.fdocuments.us/reader033/viewer/2022043010/5f9ea09717c943275e7cac85/html5/thumbnails/3.jpg)
Session Overview
![Page 4: Creating Modern Site Templates Using Site Designs · 2020-05-08 · SharePoint Online Storage Queue Azure Function Microsoft Flow Site URL is used as a parameter to connect to site](https://reader033.fdocuments.us/reader033/viewer/2022043010/5f9ea09717c943275e7cac85/html5/thumbnails/4.jpg)
![Page 5: Creating Modern Site Templates Using Site Designs · 2020-05-08 · SharePoint Online Storage Queue Azure Function Microsoft Flow Site URL is used as a parameter to connect to site](https://reader033.fdocuments.us/reader033/viewer/2022043010/5f9ea09717c943275e7cac85/html5/thumbnails/5.jpg)
The Bad and the Ugly
• Only worked for Classic Team sites – “cheating” on Publishing sites often
broke
• So flaky they removed it from SharePoint Online
• No way to update sites once they are created
• Brittle – content sometimes breaks (error when clicking on a list for
example)
• Difficult to debug; generally arcane
The Good
• Easy peasy – make a sample of what you want, save as a template, then
use the template to create new site(s)
![Page 6: Creating Modern Site Templates Using Site Designs · 2020-05-08 · SharePoint Online Storage Queue Azure Function Microsoft Flow Site URL is used as a parameter to connect to site](https://reader033.fdocuments.us/reader033/viewer/2022043010/5f9ea09717c943275e7cac85/html5/thumbnails/6.jpg)
It takes work to be this beautiful!
![Page 7: Creating Modern Site Templates Using Site Designs · 2020-05-08 · SharePoint Online Storage Queue Azure Function Microsoft Flow Site URL is used as a parameter to connect to site](https://reader033.fdocuments.us/reader033/viewer/2022043010/5f9ea09717c943275e7cac85/html5/thumbnails/7.jpg)
See: Idempotent Site Scripts for SharePoint
![Page 8: Creating Modern Site Templates Using Site Designs · 2020-05-08 · SharePoint Online Storage Queue Azure Function Microsoft Flow Site URL is used as a parameter to connect to site](https://reader033.fdocuments.us/reader033/viewer/2022043010/5f9ea09717c943275e7cac85/html5/thumbnails/8.jpg)
Using Site Scripts to Deploy Content Types
See: SharePoint site design and site script overview and Site design JSON schema: Define a new content type
![Page 9: Creating Modern Site Templates Using Site Designs · 2020-05-08 · SharePoint Online Storage Queue Azure Function Microsoft Flow Site URL is used as a parameter to connect to site](https://reader033.fdocuments.us/reader033/viewer/2022043010/5f9ea09717c943275e7cac85/html5/thumbnails/9.jpg)
Site designs: modern templating model
A new script model to apply custom “actions” to a site after creation.
This approach is inspired by the “remote provisioning” pattern we’ve espoused through PnP
![Page 10: Creating Modern Site Templates Using Site Designs · 2020-05-08 · SharePoint Online Storage Queue Azure Function Microsoft Flow Site URL is used as a parameter to connect to site](https://reader033.fdocuments.us/reader033/viewer/2022043010/5f9ea09717c943275e7cac85/html5/thumbnails/10.jpg)
• Updating existing sites with common site elements
• Configuring sites associated to a hub
Site Instances
Site Instances
Site Instances
Site Instances
![Page 11: Creating Modern Site Templates Using Site Designs · 2020-05-08 · SharePoint Online Storage Queue Azure Function Microsoft Flow Site URL is used as a parameter to connect to site](https://reader033.fdocuments.us/reader033/viewer/2022043010/5f9ea09717c943275e7cac85/html5/thumbnails/11.jpg)
Available Site Script Actions
JSON Schema: https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/site-design-json-schema
Site Settings
• addPrincipalToSPGroup
• addNavLink
• removeNavLink
• applyTheme
• setSiteLogo
• setSiteBranding
• setRegionalSettings
• setSiteExternalSharingCapability
• triggerFlow
• joinHubSite
• activateSPFeature
SharePoint Components Apps & Solutions
• createSPList
• addSPField
• deleteSPField
• addSPFieldXml
• createSiteColumn
• createSiteColumnXml
• addSiteColumn
• addContentType
• createContentType
• removeContentType
• addSPView
• removeSPView
• setSPFieldCustomFormatter
• installSolution
• SPFx Extension support• associateExtension
• associateListViewCommandSet
• associateFieldCustomizer
![Page 12: Creating Modern Site Templates Using Site Designs · 2020-05-08 · SharePoint Online Storage Queue Azure Function Microsoft Flow Site URL is used as a parameter to connect to site](https://reader033.fdocuments.us/reader033/viewer/2022043010/5f9ea09717c943275e7cac85/html5/thumbnails/12.jpg)
"$schema": "schema.json",actions: [...{
"verb": "createSPList","listName": "Contoso Project Tracker","templateType": 100,"subactions": [
{"verb": "SetDescription","description": "Custom list to illustrate
SharePoint site scripting capabilities"},{
"verb": "addContentType","name": "Contoso Projects"
},{
"verb": "addSPFieldXml","schemaXml": "<Field Type=\"Choice\"
DisplayName=\"Project Status\" Required=\"FALSE\" Format=\"Dropdown\" StaticName=\"ProjectStatus\" Name=\"ProjectStatus\"><Default>In progress</Default><CHOICES><CHOICE>In progress</CHOICE><CHOICE>In review</CHOICE><CHOICE>Has issues</CHOICE><CHOICE>Done</CHOICE></CHOICES></Field>"
},{
"verb": "addSPView","name": "Contoso Projects by Status","viewFields":
...
Site Script: JSON file of
actions to be applied to the
site post-creation
Actions can be concatenated in
single file or multiple files can be
used (and reused)
Add-SPOSiteDesign-Title <string>-WebTemplate <string>-SiteScripts <SPOSiteScriptPipeBind[]>[-Description <string>][-PreviewImageUrl <string>][-PreviewImageAltText <string>][-IsDefault]
Site Design attributes
designate display
characteristics and target
template
LIMITS• 100 site scripts and site designs
per tenant
• 30 actions/design if applied sync
(Invoke-SPOSiteDesign)
300 actions if applied async
(UI or Add-SPOSiteDesignTask)
• 30K characters/design
![Page 13: Creating Modern Site Templates Using Site Designs · 2020-05-08 · SharePoint Online Storage Queue Azure Function Microsoft Flow Site URL is used as a parameter to connect to site](https://reader033.fdocuments.us/reader033/viewer/2022043010/5f9ea09717c943275e7cac85/html5/thumbnails/13.jpg)
![Page 14: Creating Modern Site Templates Using Site Designs · 2020-05-08 · SharePoint Online Storage Queue Azure Function Microsoft Flow Site URL is used as a parameter to connect to site](https://reader033.fdocuments.us/reader033/viewer/2022043010/5f9ea09717c943275e7cac85/html5/thumbnails/14.jpg)
Get-SPOSiteScriptFromWeb –WebUrl $siteUrl-IncludeTheming –IncludeBranding-IncludeSiteExternalSharingCapability–IncludeRegionalSettings–IncludeLists $relativeListUrls
![Page 16: Creating Modern Site Templates Using Site Designs · 2020-05-08 · SharePoint Online Storage Queue Azure Function Microsoft Flow Site URL is used as a parameter to connect to site](https://reader033.fdocuments.us/reader033/viewer/2022043010/5f9ea09717c943275e7cac85/html5/thumbnails/16.jpg)
Tips and Tricks – Create a Theme per Site Design
![Page 17: Creating Modern Site Templates Using Site Designs · 2020-05-08 · SharePoint Online Storage Queue Azure Function Microsoft Flow Site URL is used as a parameter to connect to site](https://reader033.fdocuments.us/reader033/viewer/2022043010/5f9ea09717c943275e7cac85/html5/thumbnails/17.jpg)
![Page 18: Creating Modern Site Templates Using Site Designs · 2020-05-08 · SharePoint Online Storage Queue Azure Function Microsoft Flow Site URL is used as a parameter to connect to site](https://reader033.fdocuments.us/reader033/viewer/2022043010/5f9ea09717c943275e7cac85/html5/thumbnails/18.jpg)
Add-SPOSiteScript -Title $siteScriptTitle –Content $siteScriptJson
Add-SPOSiteDesign -SiteScripts [$siteScript.Id]-Title $siteDesignTitle -WebTemplate $webTemplate-Description $siteDesignDescription-PreviewImageUrl $previewImageUrl-DesignPackageId $designPackageId
Grant-SPOSiteDesignRights -Identity $siteDesign.Id-Principals ("[email protected]")-Rights View
Set-SPOHubSite $hubSiteUrl -SiteDesignId $siteDesign.Id
Invoke-SPOSiteDesign -Identity $siteDesign.Id-WebUrl "https://contoso.sharepoint.com/sites/projectawesome"
Add-SPOSiteDesignTask -SiteDesignId $siteDesign.Id-WebUrl "https://contoso.sharepoint.com/sites/projectawesome"
Site Design PowerShell
![Page 19: Creating Modern Site Templates Using Site Designs · 2020-05-08 · SharePoint Online Storage Queue Azure Function Microsoft Flow Site URL is used as a parameter to connect to site](https://reader033.fdocuments.us/reader033/viewer/2022043010/5f9ea09717c943275e7cac85/html5/thumbnails/19.jpg)
var flowScript = {"$schema": "schema.json","actions": [{
"primary_verb": "Flow.Trigger","target": “<<http post url>>","name": “contoso hr additions","parameters": {
"department": "HR","cost center": "1023"
}}
],"bindata": {},"version": 1
};
Site Scripts with app integrationHow to integrate custom logic into out-of-box provisioning flow
SharePoint
Online
Storage
Queue
Azure Function
Microsoft Flow
Site URL is used as a parameter to connect to site
using remote APIs. Customizations applied using
remote provisioning techniques, for example with
PnP remote provisioning template model.
Script initiates previously configured flow, using
the newly created site URL as parameter. Flow
includes a step to pass site URL to Azure storage
queue for delegating processing to Azure side.
1 2
3
4
triggerFlow script action
• Site URL
• Site Description
• Created By
• Creator Email
• UTC Creation Time
![Page 20: Creating Modern Site Templates Using Site Designs · 2020-05-08 · SharePoint Online Storage Queue Azure Function Microsoft Flow Site URL is used as a parameter to connect to site](https://reader033.fdocuments.us/reader033/viewer/2022043010/5f9ea09717c943275e7cac85/html5/thumbnails/20.jpg)
Site Designs for Existing Sites!
PowerShell or REST can be used to apply a published design to a site.
![Page 21: Creating Modern Site Templates Using Site Designs · 2020-05-08 · SharePoint Online Storage Queue Azure Function Microsoft Flow Site URL is used as a parameter to connect to site](https://reader033.fdocuments.us/reader033/viewer/2022043010/5f9ea09717c943275e7cac85/html5/thumbnails/21.jpg)
![Page 22: Creating Modern Site Templates Using Site Designs · 2020-05-08 · SharePoint Online Storage Queue Azure Function Microsoft Flow Site URL is used as a parameter to connect to site](https://reader033.fdocuments.us/reader033/viewer/2022043010/5f9ea09717c943275e7cac85/html5/thumbnails/22.jpg)
Notes
![Page 23: Creating Modern Site Templates Using Site Designs · 2020-05-08 · SharePoint Online Storage Queue Azure Function Microsoft Flow Site URL is used as a parameter to connect to site](https://reader033.fdocuments.us/reader033/viewer/2022043010/5f9ea09717c943275e7cac85/html5/thumbnails/23.jpg)
http://bit.ly/UltimateGuide2SiteDesigns
http://bit.ly/SiteDesignOverview
http://bit.ly/SiteDesignSchema
http://bit.ly/SwoopingSiteDesigns
http://bit.ly/SwoopingSampleCode
http://bit.ly/SiteDesignAttachHubs
http://bit.ly/OfficeThemeGen
![Page 24: Creating Modern Site Templates Using Site Designs · 2020-05-08 · SharePoint Online Storage Queue Azure Function Microsoft Flow Site URL is used as a parameter to connect to site](https://reader033.fdocuments.us/reader033/viewer/2022043010/5f9ea09717c943275e7cac85/html5/thumbnails/24.jpg)
![Page 25: Creating Modern Site Templates Using Site Designs · 2020-05-08 · SharePoint Online Storage Queue Azure Function Microsoft Flow Site URL is used as a parameter to connect to site](https://reader033.fdocuments.us/reader033/viewer/2022043010/5f9ea09717c943275e7cac85/html5/thumbnails/25.jpg)
@toddklindt
www.toddklindt.com
www.toddklindt.com/SPSNashville
![Page 26: Creating Modern Site Templates Using Site Designs · 2020-05-08 · SharePoint Online Storage Queue Azure Function Microsoft Flow Site URL is used as a parameter to connect to site](https://reader033.fdocuments.us/reader033/viewer/2022043010/5f9ea09717c943275e7cac85/html5/thumbnails/26.jpg)
Session Feedbackbit.ly/O365N-Todd
• Anonymous
• Results go to Speaker
• Greatly Appreciated