in

SharePoint Blogs

The Best Place for SharePoint-related Blogs

This Blog

Syndication

Recent Posts

Tags

No tags have been created or used yet.

Archives

vandest's blog

2003 : Wanna know if a site has a custom theme applied to it?

During upgrading you might be interested in knowing which custom webparts are used on sites or how to migrate the userprofiles but there is another thing that if you don't upgrade it correctly your users will complain about it immediately and that is custom themes! It's pretty easy to figure out which sites (webs actually) do have a custom theme applied to it.

SPGlobalAdmin globAdmin = new SPGlobalAdmin();
SPVirtualServer vServer = globAdmin.OpenVirtualServer(new Uri("portalurl"));
                
foreach (SPSite site in vServer.Sites)            
{
                    
    foreach (SPWeb web in site.AllWebs)
    {
        if (web.Theme != string.Empty)
        {Console.WriteLine(web.Url.ToString() + "|"+ web.Theme.ToString());}
                        
        web.Close();
        web.Dispose();
    }

site.Close();
site.Dispose();
}
.csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }

It's quite funny to see that you only get a result back if there is another than the default theme is applied.

Read the complete post at http://feeds.feedburner.com/~r/RobinsSharepointBlog/~3/153319447/2003-wanna-know-if-site-has-custom.html


Need SharePoint Training? Attend a SharePoint Bootcamp!

Posts (c) their respective authors. Everything else (c) 2007 SharePoint Experts