Save list as template in SharePoint online missing

In this SharePoint tutorial, we will discuss how to fix the error Save list as template missing in SharePoint Online.

I will also explain to you, how to save list as template in SharePoint Online using PowerShell.

Save list as template is a very good feature in SharePoint. We can reuse a SharePoint list by saving the list as template. Then we can download and upload to another site and can reuse it. But if you are working on SharePoint Online modern team sites, then you might not see the Save list as template option in the list settings page under Permissions and Management.

According to Microsoft, SharePoint Online group-connected team sites do not currently support list templates. For other SharePoint Online sites, enable scripting to use list templates.

Save list as template missing in SharePoint Online modern team site

Follow the below steps to enable Save list as template in a list in SharePoint Online modern team sites.

Run the below SharePoint Online management shell cmdlets.

Import-Module Microsoft.Online.SharePoint.Powershell
$tenantName = "Yourtenantname"
$SiteURL ="https://$($tenantName).sharepoint.com/sites/TSInfoModernSite"
Connect-SPOService -Url "https://$($tenantName)-admin.sharepoint.com"
Set-SPOsite $SiteURL -DenyAddAndCustomizePages 0

If in your Office 365 tenant, the custom script is already enabled then, after running the above cmdlets, you can be able to see the Save list as template option in SharePoint Online modern team sites.

But if you do not have custom scripts enabled then follow the below steps to enable custom script at the tenant level.

We can do this at the SharePoint Online admin center.

Open SharePoint admin center and if you are using the modern SharePoint admin center, then click on Settings from the left navigation and then click on Can’t find the setting you’re looking for? Go to the classic settings page like below:

save list as template missing sharepoint online
save list as template missing sharepoint online

This will open the Tenant Settings page, there search for Custom Script.

Here choose Allow users to run custom script on personal sites and Allow users to run custom script on self-service created sites radio button like below:

save list as template sharepoint online missing
save list as template sharepoint online missing

Alternatively, you can also access the Tenant Settings page directly like below:

https://<tenantname>-admin.sharepoint.com/_layouts/15/online/TenantSettings.aspx

Note: It may take 24 hours to reflect the changes, but usually it takes less time to reflect.

Once you enable custom script, now you can see the Save list as template option like below:

sharepoint save list as template missing
sharepoint save list as template missing

This is how to fix the error, list template gallery is missing in sharepoint online.

Save list as template in SharePoint Online using PowerShell

Now, let us discuss, how to save list as a template in SharePoint using PowerShell. It will work in SharePoint 2013/2016 as well as SharePoint 2019. Also, we will see how to save list as template in SharePoint Online using PowerShell and using PnP PowerShell.

Save list as template SharePoint using PowerShell

The code I have used in SharePoint 2016 site, but will work in SharePoint 2013 as well as in SharePoint 2019 as well.

You can run the PowerShell script in PowerShell ISE.

$templateFileName="Product Template File Name"
$templateName="Product Template"
$templateDesc="Use this template to create product list"
$includeContent=$true

$web = Get-SPWeb "http://mypc/sites/MySP2016SiteCollection/"
$List = $web.Lists["Products"]
$List.SaveAsTemplate($templateFileName, $templateName, $templateDesc, $includeContent)

Here, you can provide the list template name, template file name, list template description.

Also, if you want to include the content, then you can make it to true.

Once you run the script, it will create the list template and stored in the SharePoint site list template gallery.

Create a list from SharePoint list template using PowerShell

Now, we will see how to create a list by using the SharePoint list template which we have already created before.

$listname="New List Name"
$web = Get-SPWeb "http://mypc/sites/MySP2016SiteCollection/"
$listTemplates = $site.GetCustomListTemplates($web)
$web.Lists.Add($listname, $listTemplates["Product Template"])

This will create a new list name as “New List Name” in the SharePoint 2013/2016/2019 site.

Create a list by using an existing list in SharePoint Online

If you are using a modern SharePoint Online site, then there is an option we can create a list from an existing list. I have written a detailed blog post, how to create a list from the existing list in SharePoint Online.

Save a list as template in SharePoint Online

You can also use the browser to save list as template in classic SharePoint Online site.

Open the SharePoint list, go to the list settings.

From the list settings page, click on “Save list as template“.

save list as template sharepoint
stp file sharepoint

Then it will ask you to provide the File name, Template name, Template description like below:

Also, if you want to include the list content, then click on “Include Content” like below:

Save list as template in SharePoint Online
stp file sharepoint

Once you click on OK, the list template will be saved in the list template gallery in SharePoint Online or SharePoint 2013/2016/2019.

Save list as template in SharePoint 2013
sharepoint stp file

You can see the list template in the list template gallery in the SharePoint site.

Save list as template in SharePoint 2016
sharepoint stp file

This is how we can save list as template in SharePoint Online or SharePoint 2013/2016/2019.

Save list as template in SharePoint Online PowerShell

Now, we will see how to save list as template in SharePoint Online using PowerShell. Here, we will use CSOM with PowerShell in SharePoint Online.

Here, I have used the below client side dlls.

  • Microsoft.SharePoint.Client.dll
  • Microsoft.SharePoint.Client.Runtime.dll

If you are using Windows 10 laptop, then you can use the SharePoint Online client side component SDK.

Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
$siteUrl = "https://tsinfo.sharepoint.com/sites/TSInfoClassic/"
$username = "bijay@tsinfo.onmicrosoft.com"
$password=ConvertTo-SecureString "***********" -AsPlainText -Force
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl)
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $password)
$ctx.Credentials = $credentials
$list = $Ctx.Web.lists.GetByTitle("Products")
$list.SaveAsTemplate("Product Template File Name", "Product Template Name", "This is the product list template description", $true)
$ctx.ExecuteQuery()

Once you execute the above PowerShell script, the SharePoint Online list template like below:

Save list as template in SharePoint 2019
sharepoint list template gallery

Save list as template SharePoint Online using PnP PowerShell

PnP PowerShell is very easy to work with SharePoint Online.

Now, we will see how to save list as template in SharePoint Online using PnP PowerShell.

Connect-PnPOnline -Url "https://tsinfo.sharepoint.com/sites/TSInfoClassic/" -Credentials (Get-credential)
$context  = Get-PnPContext
$list = Get-PnpList -Identity "Products"
$list.SaveAsTemplate("PnP Product List Template Filename", "PnP Product List Template", "This list template is created using PnP", $true)
$context.ExecuteQuery()
sharepoint online save list as template
sharepoint .stp file

Once you execute the code, it will ask you to enter the credentials and then it will Save the list as a template in SharePoint.

save list as template sharepoint online pnp powershell
stp file sharepoint

This is how to save list as template SharePoint Online using PnP PowerShell.

How to extract and make SharePoint stp file

We can extract a .stp file and then how we can make a .stp file from the extracted files in SharePoint. We have created a custom list template which usually saves as a .stp file. After saving this .stp file we wanted to modify something in the manifest.xml file.

First, you can extract the .stp file. Here I have used 7-Zip to extract it like below:

extract stp file sharepoint
extract stp file sharepoint

Once it is successfully extracted, you can see the manifest.xml file.

Then you can modify the file using Notepad or Notepad++ (any editor you can use). Once the modification over we can run the below command to create the .stp file again.

Here I have kept the manifest.xml file in the d drive and running the below command.

makecab.exe manifest.xml WorkflowMailTemplates.stp

how to edit a list template in sharepoint 2013
Edit a list template in SharePoint 2013

This is how to extract .stp file and make .stp file in SharePoint Online and how to change in manifest.xml file in SharePoint.

You may like the following SharePoint tutorials:

I hope this SharePoint tutorial explains, how to solve save list as template missing in sharepoint online modern team site issue.

>