Wednesday, June 11, 2008, 09:27 - SharePoint
Posted by Administrator
here's my small code snippet that enables an administrator to change the theme and the icon of an entire sitecollection at once.Posted by Administrator
here it is:
public enum SPSiteThemes {
none,
classic,
simple,
Belltown,
Breeze2,
Cardinal,
Citrus,
Granite,
Jet,
Lacquer,
Lichen,
Obsidian,
Petal,
Plastic,
Reflector,
Verdant,
Vintage,
Wheat
}
private void ApplyThemeToWeb(SPSiteThemes Theme, SPWeb Web, bool Recurse)
{
Web.ApplyTheme(Theme.ToString());
if (Recurse) {
foreach (SPWeb subweb in Web.Webs) {
try
{
ApplyThemeToWeb(Theme, subweb, Recurse);
}
finally {
subweb.Dispose();
}
}
}
Web.Update();
}
private void ApplyIconToWeb(string IconURL, SPWeb Web, bool Recurse)
{
Web.SiteLogoUrl = IconURL;
Console.WriteLine(Web.Title + " updated to " + IconURL.ToString());
if (Recurse)
{
foreach (SPWeb subweb in Web.Webs)
{
try
{
ApplyIconToWeb(IconURL, subweb, Recurse);
}
finally
{
subweb.Dispose();
}
}
}
Web.Update();
}




( 3 / 497 )

Tom Van Gaever - Blog
Avatar






