How to Export a List Template in SharePoint Online using PowerShell?

Requirement: Export List Templates in SharePoint Online using PowerShell.

List templates in SharePoint Online enable you to reuse any list with its fields, formulas, formatting, and optionally data in other site collections without re-creating the list again. List Templates should be downloaded and uploaded to other sites in order to create lists from them. In this tutorial, we will guide you through the process of downloading a list template from SharePoint Online to use for creating new lists or libraries on your SharePoint site.

How to export a List Template in SharePoint Online?

To download a list template from the SharePoint Online site, do the following:

  1. Click on Settings gear >> Site settings page >> Click on “List Templates” under Web Designer Galleries (List template gallery in SharePoint Online URL:
  2. In the “List templates Gallery”, click on the “Name” column link for the list template you want to download. 
    export list template sharepoint online
  3. This triggers a file download prompt. Click Save to download the file.
    download list template sharepoint online

The list Templates feature is scoped at site collection. So, it will be available only at top-level site settings!

PowerShell to Export List Template in SharePoint Online

Here is the PowerShell to download a list template SharePoint Online:

#Load SharePoint CSOM Assemblies
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"

#Function to download a list template from SharePoint Online using powershell
Function Download-SPOListTemplate
        [string]$SiteURL  = $(throw "Enter the Site URL!"),
        [string]$ListTemplateName = $(throw "Enter the List Template Name!"),
        [string]$ExportFile = $(throw "Enter the File Name to Export List Template!")
    Try {
        #Get Credentials to connect
        $Cred= Get-Credential
        $Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)
        #Setup the context
        $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
        $Ctx.Credentials = $Credentials
        #Get the "List Templates" Library
        $List= $Ctx.web.Lists.GetByTitle("List Template Gallery")
        $ListTemplates = $List.GetItems([Microsoft.SharePoint.Client.CamlQuery]::CreateAllItemsQuery()) 

        #Filter and get given List Template
        $ListTemplate = $ListTemplates | where { $_["TemplateTitle"] -eq $ListTemplateName }

        If($ListTemplate -ne $Null)
            #Get the File from the List item

            #Download the list template
            $FileInfo = [Microsoft.SharePoint.Client.File]::OpenBinaryDirect($Ctx,$ListTemplate.File.ServerRelativeUrl)
            $WriteStream = [System.IO.File]::Open($ExportFile,[System.IO.FileMode]::Create)

            write-host -f Green "List Template Downloaded to $ExportFile!" $_.Exception.Message
            Write-host -f Yellow "List Template Not Found:"$ListTemplateName
    Catch {
        write-host -f Red "Error Downloading List Template!" $_.Exception.Message

$SiteURL = ""
$ListTemplateName= "Projects Template"
$ExportFile = "C:\Temp\CrescentProject.stp"

#Call the function to Download the list template
Download-SPOListTemplate -SiteURL $SiteURL -ListTemplateName $ListTemplateName -ExportFile $ExportFile

This PowerShell script exports the list template in SharePoint Online. To deploy a list template in SharePoint Online, use: How to upload a list template to SharePoint Online using PowerShell?


In conclusion, exporting a list template from SharePoint Online is a quick and simple process that can save organizations time and effort when creating new lists. By following the steps outlined in this article, you can easily create a list template and export it for use in other SharePoint Online sites. This can be particularly useful for organizations that have complex list structures or want to standardize the way information is stored and managed in SharePoint Online. By exporting list templates in SharePoint Online, you can help ensure that your lists are consistent, easy to manage, and tailored to meet the needs of your organization.

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

Leave a Reply

Your email address will not be published. Required fields are marked *