Click on this icon to open the XML page.Tom Van Gaever - Blog
Search:   

SPWeb themes and Icons 
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.

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();
}



add comment ( 7 views )   |  permalink   |   ( 3 / 497 )

<<First <Back | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Next> Last>>