Navigation

Tuesday, 10 March 2015

All Available SharePoint Web Template ID

In my scenario, this is very useful for SharePoint branding. I utilize it when feature activating event to apply different custom master page for My Site / Search Site based on the Web Template ID.

function Get-SPWebTemplateWithId
{
 $templates = Get-SPWebTemplate | Sort-Object "Name"
 $templates | ForEach-Object {
  $templateValues = @{
   "Title" = $_.Title
   "Name" = $_.Name
   "ID" = $_.ID
   "Custom" = $_.Custom
   "LocaleId" = $_.LocaleId
  }
  New-Object PSObject -Property $templateValues | Select @("Name","Title","LocaleId","Custom","ID")
 }
}
 
Get-SPWebTemplateWithId | Format-Table

No comments:

Post a Comment