SharePoint Online: Create List from Custom Template using PowerShell

Requirement: Create List from Custom List Template using PowerShell in SharePoint Online.

SharePoint Online: How to Create List from Template?
List templates in SharePoint Online saves a lot of time by reusing any existing list or library, which comprises all columns and optionally the data from the list. You can create any number of copies from the list template.

Assuming you have an existing list template in the site, Here is how to create a list from a template SharePoint Online
  • Login to your SharePoint Online site >> Click on Settings gear icon and click "Add an app"
  • You can use the pagination to find your list template, or use "Find an App" search box and pick your list template.
    sharepoint online create list from custom template
  • Provide a name to your new list and click on "OK". This creates new list from template in SharePoint Online.
  • You will see a new list created with same list schema, and also data if you have selected "Include Content" when creating the list template originally. Let's see the SharePoint Online PowerShell to create list from template.

SharePoint Online: Create List from Template using PowerShell
Let's use PowerShell in SharePoint Online to create list from custom template.
#Load SharePoint Online 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"

#Config Variables
$ListTemplateName = "Quick Links Template"
$ListName="Quick Links V2"

#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 All Lists
$Lists = $Ctx.Web.Lists

#Get the Custom list template

#Filter Specific List Template
$ListTemplate = $ListTemplates | where { $_.Name -eq $ListTemplateName } 
If($ListTemplate -ne $Null)
    #Check if the given List exists
    $List = $Lists | where {$_.Title -eq $ListName}
    If($List -eq $Null)
        #Create new list from custom list template
        $ListCreation = New-Object Microsoft.SharePoint.Client.ListCreationInformation
        $ListCreation.Title = $ListName
        $ListCreation.ListTemplate = $ListTemplate
        $List = $Lists.Add($ListCreation)
        Write-host -f Green "List Created from Custom List Template Successfully!"
        Write-host -f Yellow "List '$($ListName)' Already Exists!"
    Write-host -f Yellow "List Template '$($ListTemplateName)' Not Found!"
Same methods applies for creating document library from custom template as well.

SharePoint Online: PnP PowerShell to Create List from Template
#Config Variables
$SiteURL = ""
$ListName = "Migation Tasks"
$ListTemplateName ="Project Tasks"
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)

#Get the Custom List Template
$Ctx = Get-PnPContext
$Web = $Ctx.Site.RootWeb
$ListTemplates = $Ctx.Site.GetCustomListTemplates($Web)
$ListTemplate = $ListTemplates | where {$_.Name -eq $ListTemplateName}

#sharepoint online powershell create list from template
$ListCreation = New-Object Microsoft.SharePoint.Client.ListCreationInformation
$ListCreation.Title = $ListName
$ListCreation.ListTemplate = $ListTemplate
SharePoint Online: Create List from Custom Template using PowerShell SharePoint Online: Create List from Custom Template using PowerShell Reviewed by Salaudeen Rajack on August 14, 2017 Rating: 5


  1. It failed when I try to create a template from English language site and list instance at German language site! script did not create list instance on German language site. Please help!

    1. You need to rename the .stp to .cab, Open the "manifest.xml" inside and change the language ID and re-pack the STP with "makecab manifest.xml template.stp"


Please Login and comment to get your questions answered!

Powered by Blogger.