In SharePoint 2007 (WSS3 - MOSS) è possibile applicare un tema via codice C# tramite il metodo ApplyTheme("IdTema") dell'oggetto SPWeb.
C#
using (SPSite site = new SPSite("http://sharepoint2007"))
{
  using (SPWeb web = site.RootWeb)
  {
    web.ApplyTheme("IdDelNuovoTema");
  }
}
Dove IdDelNuovoTema è l'id assegnato all'interno del file ...\12\TEMPLATE\LAYOUTS\[LCID]\SPTHEMES.XML, tag TemplateID.

Per riapplicare un tema ad un sito che già usa quel tema, bisogna prima applicare un altro tema.
C#
using (SPSite site = new SPSite("http://sharepoint2007"))
{
  using (SPWeb web = site.RootWeb)
  {
    web.AllowUnsafeUpdates = true;
    web.ApplyTheme("Jet"); //id altro tema
    web.ApplyTheme("IdDelNuovoTema"); // id del tema da riapplicare
  }
}
Potrebbe interessarti anche: