Question

Is there a way to save site as a template if you are using Modern sites? I have followed some tutorials online where you use a script to enable scripting on site. I have also made sure if the Publishing features are disabled.

Is there a way to save modern sites as template. It was easy to do in Classic sites. Is this even an option for modern sites?

Was it helpful?

Solution

We can save the modern site (modern team site and communication site) as the site template by visiting /_layouts/savetmpl.aspx page.

When you access /_layouts/savetmpl.aspx , access denied may occur. It occurs because the denyaddandcustomizepages of this site is true. DenyAddAndCustomizePages determines whether the Add And Customize Pages right is denied on the site collection. By default, the right is denied on the modern site collection.

We need to connect to SharePoint Online using PowerShell and set denyaddandcustomizepages of the site to false.

$adminUPN="<admin>@<tenant>.onmicrosoft.com"
$userCredential = Get-Credential -UserName $adminUPN -Message "Type the password."

Connect-SPOService -Url https://<tenant>-admin.sharepoint.com -Credential $userCredential
set-sposite https://<tenant>.sharepoint.com/sites/<communication/team> -denyaddandcustomizepages $false

Ten, you can access /_layouts/savetmpl.aspx page and save the site as template.

OTHER TIPS

No, Modern Team/Communication sites do not support the save as template function -- in part because it was a bad idea in the first place, and because they have Publishing functionality enabled at all times with no ability to disable it.

The closest you can come to template-like functionality is via Site Designs.

First, go-to your sharepoint admin central and allow custom scripts in the settings section

enter image description here

Now, in the SharePoint online management shell, run the following powershell commands one after the other

Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking

Connect-SPOService -Url https://yourname-admin.sharepoint.com/

This will prompt for user name and password

Set-SPOsite "https://yourname.sharepoint.com/sites/yoursite" -DenyAddAndCustomizePages 0

Once you run this, you should be able to save your site as template by visiting site settings and clicking on "Save site as Template"

You can create site templates of team and communication sites and it actually works quite well. http://webbrewers.com/modern-sharepoint-create-a-site-template-yes-communications-sites-too/

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top