Presentation used in SharePoint Site Design and Site Script Patterns and Practices (PnP) webcast.Covers key areas around the topic and how to modify the out-of-the-box provisioning logic, including the extensibility story.
3. site scripts site designs
Custom scripting of sites
through provisioning
Site designs can be
injected into in-product
provisioning experience
to automate consistent
site creation
Apply site settings and
call custom solutions
Provision select settings
after creation; use
Microsoft Flow to call
apply additional business
logic
Clean & consistently
branded sites
Apply company theme or
custom page designs at
time of creation
4. Site Scripts -
Actions
• Create List
• Apply Theme
• Add to nav
• Trigger Flow
• Join a hub site
Site design selections appear in
site provisioning UX (per base
template)
Execute Site
Design
During site creation we create a parameter in site
property bag – this is used by site design feature to
apply site scripts.
2
3
After site creation script actions are
initialized and processed – as each are
run, they are saved to a local list and
rendered in progress panel
1
5. var listRecipe = {
"$schema": "schema.json",
"actions": [
{
"primary_verb": "List.CreateOrOpen",
"target": "Customer Tracking",
"templateType": 100,
"verbs": [
{
"verb": "SetDescription",
"description": "List of Customers and Orders"
},
{
"verb": "AddFieldIfNotExist",
"fieldType": "Text",
"displayName": "Customer Name",
"isRequired": false,
"addToDefaultView": true
},
{
"verb": "AddFieldIfNotExist",
"fieldType": "DateTime",
"displayName": "Date of Delivery",
"isRequired": true
},
]
},
{
primary_verb: "Theme.Apply",
target: "Contoso Travel Green"
}
],
"bindata": {},
"version": 1
};
JSON syntax of site
configuration actions to be
applied for the site
Script actions can be
concatenated in single file or
multiple files can be used
(and reused)
RestRequest("/_api/Microsoft.Sharepoint.Utilities.WebTemplateExtensions.Scr
iptUtility.CreateSiteDesign", {info:{Title:"Contoso Travel - Legal Case Book",
Description:"Restricted site design to create a legal case book site",
ScriptGuids:["b432a1cd-7e1f-4fb1-9829-633d8MaG1C”], IsDefault:true,
WebTemplate:"68"}});
Site Design attributes
designate display
characteristics and target
template
6. Create lists/libraries (incl. settings)
Add a site navigation link
Apply company themes
Set a site logo
Join a hub site
Trigger logic apps (using Microsoft Flow)
…with more to come
* Create modern pages; set as home page
* Add declarative formatting to a column
* Join site to Hub
* Enable external access
* Set site classification
7. var flowRecipe = {
"$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
};
SharePoint
Online
Storage
Queue
Azure Function
Microsoft Flow
Business logic will handle the message
processing. Site URL is used as a parameter to
connect to site using remote APIs. Applies
needed customization using remote
provisioning techniques, for example with PnP
remote provisioning template model.
Script configured to start
previously configured flow,
which will receive 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
8. Add additional site designs for each template
Scope a site design to a select set of users
Add additional business logic using Microsoft
Flow
Templates have traditionally been one way to do it – but they have their limitations.
If you joined me last year Vesa and I talked about the options and challenges of several site template approaches – and highlighted the value of the remote provisioning pattern as an alternative to established ways of provisioning and branding SP sites.
The great thing about remote provisioning is it addresses the problems of upgradeability and availability – but it is remote
Instead of customizing site templates – and losing value of future updates – we’re building on this async provisioning pattern – providing a way to extend and programmatically apply configurations post-creation
This week we’re also announcing a new site extension capability – site designs.
The driver here was really around two principles:
We need to provide extensibility so customized sites (whether by design or function) can be created and reused w/o being orphaned as we release new capabilities (read: future-proof designs)
We need to provide flexible governance framework to provide appropriate administration and controls for enterprise IT
Three areas of configuration: look & feel; site settings; custom apps & business logic
Site Script
A declarative script executed post-site creation for applying a set of defined site configurations, like custom lists, libraries, features (incl. updates to what we provide in base templates)
The actions define configurable site elements and settings that are commonly performed in the customization of a site
Site Design
This is the entity a user would choose at creation time to make their newly created site a certain way.
Internally, it refers to the site formula or combination of components (base template + site properties/metadata + configuration recipe) presented to user in self-service site provisioning flow
This list will support audience-targeting so customers can scope who can select which site designs during provisioning
Currently only planned for application to modern site templates (team and communication)
Specifics of the implementation
We store JSON script blobs in a tenant (recipe) library
Site designs are stored in a tenant (formula) list
When a site gets created w/ REST call – we now create a paramater in the site property bag
During stage 3 feature activation we check if this parameter is there and then apply the designated design (or default | nothing at all)
The feature is activated in timer job and reads parameter from web, applying each recipe script in sequential order
As each action is run it is saved to a list in /_catalogs/wte list in the site collection – and presented in progress panel
The combination of site script w/ design – intended to provide a modern, IT-Pro / IW focused replacement to “save site as template”
Very similar to PnP model where we execute a set of configuration instructions on a site asynchronously – whether @ time 0 or time N
Idempotent model allows us to re-run a recipe multiple times without changing the result beyond the initial application
Scripts are intended to be flexible – to extend sites safely and consistently w/in a tenant - and in a manner that can accommodate upgradeability
All centrally stored w/ APIs so they can be leveraged across tenant
We are focusing on key settings and actions that folks commonly need to configure or wish to automate
But we recognize folks have existing investments – and it will take awhile to have everything in this new syntax
As you saw me demonstrate at the top of the session – leveraging Flow to orchestrate other actions is a powerful model – and one where we saw an opportunity to help our users even leverage existing solutions and investments
Let me walk through a flow for triggering a flow that will demonstrate in a moment
This flow walks through the triggerFlow action – align w/ intro demo
Let’s look @ the application of these capabilities w/ four scenarios
FEEDBACK: Flow is cool, but build up; don’t diminish value of the features we’re bringing to bear here. 1. no flow; 2. basic flow; 3 full pnp solution; see MikeAm’s email
Default team site: list, library, theme
This scenario could also be done from OWA to demonstrate that the same custom site design can get applied, even if creation done from another entry point (I likely won’t demo this, but just mention it)
Adding additional ones: look @ Contoso Sales Event
This scenario demonstrates how a custom site design can be applied to both templates - and integrated into UX by being added to the existing site design picker (even reuse the same script)
Scoping: Melissa sees (a) the demo (b) blue yonder campaign
This scenario demonstrates how we support restricting site designs to select groups of users. The actual implementation is currently complicated so I won't talk about that much, except to demonstrate that we can support scoping to a SG
Extending w/ Flow: Contoso Travel – Focus Project
This scenario demonstrates calling Vesa’s Azure function
Show the yeoman generator and talk about the options
C:\spfx\spfx-react-extension