Create list from custom template in SharePoint with PowerShell

This examples shows how to create new lists from custom list templates in SharePoint using PowerShell and CSOM. Custom list templates are STP-files uploaded to the List Template Gallery on the site. This should work both on-premises (2013/2016) and Online (Office 365).

Note: This example uses commands from the Office Dev PnP PowerShell library, ex. “Connect-PnPContext”. I recommend using this library for working this PowerShell and SharePoint (both Online and On-Premises).

9 Replies to “Create list from custom template in SharePoint with PowerShell”

  1. Hi,
    Thanks for this post.It is useful for creating the list with custom list template.
    I have tried to create a list with my custom list using a template.In my case the list is created successfully but without any column names and data.
    only title column is showing and other columns from my custom list template is not created and no data also.
    Please help me to create a list with same template.


  2. Try the following instead…

    $ListCreation = New-Object Microsoft.SharePoint.Client.ListCreationInformation
    $ListCreation.Title = $ListName

    ## Add Line Below ##
    $ListInfo.ListTemplate = $ListTemplate

    ## Optional / Good Practice ##
    #$ListCreation.TemplateFeatureId = $ListTemplate.FeatureId
    ## Optional / Good Practice ##
    #$ListCreation.TemplateType = $ListTemplate.ListTemplateTypeKind

    (See ListCreationInformation properties


    1. Hi, there is something easier to do :
      You can replace THIS
      [ if ($ListTemplate -eq $null)
      Throw [System.Exception] “Template not found”

      $ListCreation = New-Object Microsoft.SharePoint.Client.ListCreationInformation
      $ListCreation.Title = $ListName
      $ListCreation.TemplateFeatureId = $ListTemplate.FeatureId
      $ListCreation.TemplateType = $ListTemplate.ListTemplateTypeKind

      Execute-PnPQuery ]

      BY THIS cmdlet PnP :
      New-PnPList -Title $ListName -Url $ListName -Template $ListTemplate.ListTemplateTypeKind
      (I just tested and this works fine !)

      Title and Url can be different of course.

      1. Like Poovi, I can use the above to create a new list but it is empty of the fields that the saved list template has. The extra comments also fail to create the fields.

    2. Thanks, Obilogic. I have now tested this myself, and your suggested change makes this work as expected again.The script example is updated (change on line 29).

  3. I get an exception when passing the $ListCreation object to the lists add method:

    Exception calling “Add” with “1” argument(s): “The object is not associated with an object identity or the object
    identity is invalid.”

    The $ListCreation object has the following properties and seems to be valid. Any thoughts?

    CustomSchemaXml :
    DataSourceProperties : {}
    Description :
    DocumentTemplateType : 0
    ListTemplate : Microsoft.SharePoint.Client.ListTemplate
    QuickLaunchOption : Off
    TemplateFeatureId : 00bfea71-de22-43b2-a848-c05709900100
    TemplateType : 100
    Title : Custom List From Template
    Url :
    TypeId : {e247b7fc-095e-4ea4-a4c9-c5d373723d8c}

  4. Hi Are, I just want to say thanks for this, very useful.

    I just have an issue as reported by others where the library is being created but is empty and does not contain any of my custom columns. If I try to add the $listcreation.ListTemplate property, I get an error stating it is not valid. Everything else works and if I create it via the SharePoint UI (add an app) and select the same template, it works fine. Any idea why?

    I am using SharePoint PnP PowerShell 2016 for on premise and have updated my module to the latest version.


    1. Hi Are, any update on creating the list with layout and content. I’m experiencing same symptoms list is created empty and no configuration of fields/views.
      Thanks a lot.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s