How to Upload a List Template in SharePoint 2013 using PowerShell?
Requirement: Upload a custom list template to specific site collections in a web application. While upload a list template using from SharePoint web interface is simple, wanted to automate this process as its repeating for multiple site collections.
PowerShell to Upload list template in SharePoint 2013:
Here is the PowerShell script to upload custom list template to SharePoint site :
PowerShell to Upload list template in SharePoint 2013:
Here is the PowerShell script to upload custom list template to SharePoint site :
Add-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue Function Upload-ListTemplate($WebURL, $TemplateFilePath) { #Get the Web $web = Get-SPWeb $WebURL #Get the List template Gallery Folder $TemplateFolder = $web.GetFolder("List Template Gallery") #Get the Files collection $TemplateFileCollection = $TemplateFolder.Files #Get the Template file from Local File system $TemplateFile = Get-ChildItem $TemplateFilePath #Open the File in Read mode and Add to Templates collection $TemplateFileCollection.Add("_catalogs/lt/$($TemplateFile.Name)", $TemplateFile.OpenRead(), $true) Write-Host "Done!Template has been uploaded!!" } #Call the function to upload list template Upload-ListTemplate "http://intranet.crescent.com" "D:\Templates\CreditTemplate.stp"You can verify the uploaded template by navigating to List template gallery: http://intranet.crescent.com/_catalogs/lt/Forms/AllItems.aspx
How to Upload a List Template in SharePoint 2013 using PowerShell?
Reviewed by Salaudeen Rajack
on
9:13 PM
Rating:

No comments:
Please Login and comment to get your questions answered!