TIP
Presented below are PowerShell methods for extracting list and site templates.Default List Templates
Default Site Templates$web = Get-SPWeb http://YourSiteURL $web.ListTemplates | Select-Object name, Type_Client, FeatureID | Sort-Object Name | Format-Table -auto
Custom List TemplatesGet-SPWebTemplate | Select-Object Name, Title, isHidden | Sort-Object Name | Format-Table -auto
References$web = Get-SPWeb http://YourSiteURL $list = $web.Lists["List Template Gallery"] $table = New-Object system.data.datatable "MyTable" $col1 = new-object system.data.datacolumn "TemplateTitle" $col2 = new-object system.data.datacolumn "TemplateType" $col3 = new-object system.data.datacolumn "FeatureID" $table.columns.add($col1) $table.columns.add($col2) $table.columns.add($col3) ForEach ($item in $list.items) {$row=$table.NewRow();$row.TemplateTitle=$item.Properties.TemplateTitle;$row.TemplateType=$item.Properties.TemplateType;$row.FeatureID=$item.Properties.FeatureID;$table.Rows.Add($row)} $Table | sort-object templateTitle -desc | format-table -auto
- List Template types and IDs in SharePoint
- Get a list of web templates and IDs in a SharePoint site
- List saved as template does not appear under Add an app or what lists can you save as template and use for creating other lists based on them
- Creating table using Powershell
- SharePoint 2013 List Templates
- Get ListTemplate and Create New List in PowerShell
- PowerShell to Get List Schema in SharePoint
Notes
- I've not been able to find the GUID property for default site templates. It's not listed. There must be some sort of unique ID for these, since some of them have the same name and must be distinguished by other means.
- Note that not all custom list template properties are found directly in the item object but that some are found in the Properties sub-object. Also, because it's a list, you can't easily extract the templates using a single command. So, instead, I created a table object, populated the table, and then displayed the object using convenient format commands.
No comments:
Post a Comment