kwizcom banner advertisement

Delete List Template in SharePoint using PowerShell

Here is how to delete SharePoint list templates using PowerShell script:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Variables for Site URL and List template name
$SiteURL="http://intranet.crescent.com/sites/sales/"
$ListTemplateName ="Project Health.stp"

#Get Site and List Template Folder objects
$site = Get-SPSite $SiteURL
$ListTemplateFolder = $site.RootWeb.GetFolder("_catalogs/lt")

#Find the Specific List template and delete
$ListTemplate = $ListTemplateFolder.Files | Where-Object { $_.Name -eq $ListTemplateName }

if($ListTemplate)
 {
    $ListTemplate.Recycle()
    #To permanently delete, call: $ListTemplate.delete();
    write-output "Deleted List template!" 
 }
Delete List Template in SharePoint using PowerShell Delete List Template in SharePoint using PowerShell Reviewed by Salaudeen Rajack on 5:29 PM Rating: 5

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.