Save list as template (.stp) and Create list using list template using power shell in SharePoint

Save list as template (.stp) and Create list using list template using power shell in SharePoint:-

Save list as template (.stp) and Create list using list template using power shell in SharePoint. Sometimes it is the requirement that we need to create a list having existing columns of another list. We need to save the list as template (.stp) into the list template gallery and then create a new list on the same site using this list template.

Today we will discuss how to Save list as template (.stp) and create list using list template using power shell in SharePoint

Save list as template (.stp) using power shell:-

The below commands will use to save the list as template.

Add-PSSnapin Microsoft.SharePoint.Powershell
$Ssite = get-spsite("http://Yoursite/")
$web = $Ssite.RootWeb
$list = $web.Lists["ListName"]
#Save For include content
$list.SaveAsTemplate(“TemplateName”,”TemplateTitle”,”TemplateDescription”,1)
#Save with out Content
$list.SaveAsTemplate(“TemplateName”,”TemplateTitle”,”TemplateDescription”,0)

Create list using list template using power shell:-

[AdSense-A]

The below commands used to create a new list using existing list template.

Add-PSSnapin Microsoft.SharePoint.Powershell
$Ssite = Get-SPSite http://yoursite
$listTemplatesName = $Ssite.GetCustomListTemplates($Sweb)
$Sweb.Lists.Add("Your new list Name", "", $listTemplatesName["ListTemplateName"])

 


Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.