Apr 15, 2019

A modern "Save List as Template"

Hi SharePoint guys,

Do you remember the "Save list as template" feature we used to find in the list settings page ?

The concept of this feature was quite nice, but it had some drawbacks and wasn't always working as expected. It was relying on feature framework and for some reasons, it requires custom script enabled on your site which, by default, is turned off on Modern experience.

Site Designs and Site Scripts

In the beginning of 2018, Microsoft has introduced the Site Designs capabilities to provide a kind built-in site templates features. A site design is composed of one or multiple site scripts that defines the customizations to apply to a site.

Get Site Script from list

Quite recently, a few months ago, an API was released to allow us to extract a site script from an existing list. (See doc here).

A Modern "Save list as template"

Leveraging these new concepts and capabilities, I wanted to create a solution the gives power users the same capability as we used to have (with some limitations) with the "Save list as template" feature. I then created an SPFx extension that allows you, from a list to get the generated site script: a "list template".

Download the site script

template-download open-template-json.gif

For regular users, that's the best we can do with client-side only solution. However, if you are a SharePoint global administrator, you can use this extension to save the site script to your tenant. Then, to be able to use your template directly, you need to associate that script to a Site Design

save-design

Once it is saved, you can apply your site design to another site

saved-site-design.gif

And here is the created list from the template

new-list.gif

You can find the code on GitHub here

Tell me what you think of it :)

See ya,

Yannick

Other posts