As we move into summer, we are pleased to announce the availability of additional site script actions and capabilities for site designs. These new actions are designed to facilitate the programmatic configuration of common site settings and elements – and can be applied both manually through PowerShell or integrated into the SharePoint Online self-service site creation experience.
Additionally, we are preparing for release support for a new scenario we announced at the May SharePoint Conference – the ability to execute a site design on a site when it joins a hub. For more details on this scenario and the newly published site script actions, read on!
New Site Script Actions
- addPrincipalToGroup – use this action to manage the addition of users and groups to default SharePoint groups (Owners, Members, Visitors, etc.). For more information, see Understanding SharePoint Groups. This action can be used for licensed users, security groups, and Office 365 Groups.
- removeNavLink – use this action to support those cases where a customer wants to remove select site links that are added as a part of the base template (or to remove previously added links by using the Invoke-SPOSiteDesign command).
- createSiteColumnXml – we’d recently released the addSPFieldXml script action to provide Field XML using Collaborative Application Markup Language (CAML). This action builds on this one to allow for the creation and inclusion of complex field types (like choice, currency, etc.) to be defined as site columns so they can now be referenced in list views and content types for broader use. You can also use the addSPLookupFieldXml script action for lookup field support. With this action, you can use Field XML to reference the desired field in the source list.
Support with additional site templates and other updates
We’ve also added support for site scripts & site designs to be applied to other SharePoint site templates, specifically our new modern team site that doesn’t include an Office 365 group (STS#3); classic team site (STS#0), and classic publishing (BLANKINTRANET#0). This change will allow you to extend applying site designs to previously created sites and will support the option to apply a site design to a site when it is joined to a hub site – a feature we announced and previewed at this year’s SharePoint Conference and will be releasing later this summer!
And there’s more on the way! We have lots of updates we’re working on for Ignite, so stay tuned and keep the feedback coming!
Site Designs JSON schema documentation has been updated accordingly in the official SharePoint developer documentation. We have now also published official JSON schema for the Site Designs, which will be kept up to date as we release new actions. You can find this schema file from https://developer.microsoft.com/en-us/json-schemas/sp/site-design-script-actions.schema.json.
New Site Script templates in GitHub
We have also released new Site Script samples to the GitHub repo, which demonstrate how to use these new Site Script actions.
- Join Hub Site – Soon you’ll be able to apply a site design to a site when it joins a hub, but you can also use the joinHubSite script action to join a site to a hub on site creation or using the Invoke-SPOSiteDesign command. We recently updated this script action to include an optional hub site name parameter.
- Column and Row Formatting – That’s right, in addition to column formatting, you can also use site scripts to apply the new row formatting to your createList script actions. This sample illustrates both column formatting and applying row formatting to a custom list view.
- Add Principal to Group – This sample template illustrates the new addPrincipalToSPGroup action and how to add principals (users, SGs, and O365 groups) to SharePoint roles
- Remove Navigation Links – This sample illustrates the new removeNavLink action and how it can be used to remove default links added by the site template
- More spfieldxml actions – This sample illustrates using Field XML to create complex list fields – including lookup columns! In addition to the previously created addSPFieldXml action you can now use createSiteColumnXml to create these fields as site columns – and we now have a addSPLookupFieldXml that can be used to specify a dependent list for the lookup field.
Your Site Script templates are also more than welcome in this repository as a reference for others in the community.
Additional resources
Review the following resources for more details on creating and using site scripts and site designs.
-
- SharePoint Site Design and Site Script Overview
- Get started creating Site Designs and Site Scripts
- Site Design JSON Schema
- Reference Site Script templates in GitHub - We do welcome community contributions here!
“Sharing is caring”
SharePoint Team, Microsoft – 8th of August 2018