Lo
script PowerShell permette di aggiungere il file theme.xml, che contiene la definizione di un nuovo tema, al file originale di
SharePoint 2007 (WSS3 - MOSS) ovvero ...12\TEMPLATE\LAYOUTS\[LCID]\SPTHEMES.XML.
#get a new theme definition file as XML object
[xml]$xmlSource = Get-Content ".\theme.xml"
#get original sharepoint file as XML object
$destFilePath = "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1040\SPTHEMES.XML"
[xml]$xmlDestination = [xml](Get-Content $destFilePath)
#merge
$temp = $xmlDestination.CreateElement("Templates")
$temp.Set_InnerXml($xmlSource.Templates.Get_InnerXml())
$xmlDestination.SPThemes.AppendChild($temp)
[xml]$v =$xmlDestination.get_outerxml().replace('xmlns=""','')
#save merged file
$v.Save($destFilePath)
Il file
theme.xml deve avere il seguente formato
<Templates>
<TemplateID>CLASSICSGART</TemplateID>
<DisplayName>Sgart Classic</DisplayName>
<Description>Qui inserisci la descrizione del tuo tema.</Description>
<Thumbnail>images/tmbCLASSICSGART.gif</Thumbnail>
<Preview>images/tmbCLASSICSGART.gif</Preview>
</Templates>
Questo è solo un esempio di come modificare in automatico il file SPTHEMES.XML. Per creare un nuovo tema vedi
Come creare un nuovo tema