I’m not sure I’ll use themes again over the AlternateCssUrl again in a hurry, but I did decide to take a look at the 10 example themes Microsoft Released in March. I’ll blog about how they look – sometime! (The short answer – some good, some bad, some awful!)
Anyway, I was interested that the themes could all be activated as features. This rather kept with my feeling on how branding should be deployed.
However, some of the themes (though not all) were suddenly available in the ‘Site Themes’ page of my SharePoint system. I knew from experience that this isn’t something that ‘just happens’ – previously, I’ve done it by hand.
EDIT: See the comments – they describe an possible pit fall, but both have articles about how to do the same thing…
I became curious, so I opened up Reflector. I found that there is a method called when the feature is installed to update the SPThemes.xml file:
ModificationType is just a private enumeration to tell you whether you are adding or removing an entry from the SPThemes file. This code is called from within a Feature Receiver during FeatureActivated FeatureInstalling (need to check, see comments below)
Anyway, I’ll remember this in case I should need to do similar. Obviously, the original code is probably simpler than the decompiled stuff.
Do you know if FeatureInstalled runs on all servers in the farm? I don’t believe it does, in which case you need to use a timer job instead:
http://solutionizing.net/2008/07/09/updating-spthemesxml-through-a-feature/
Cheers ~
Keith
Andy, great article! I’ve done something similar here which may help: http://www.devexpertise.com/2009/02/11/installing-a-theme-as-a-sharepoint-feature/
I thought FeatureInstalled ran on all servers, as the feature is *installed* on all servers of the farm. I thought FeatureActivated only ran on one server. But I could be wrong, I’ve not checked…
Good comments anyway, guys, both were interesting links. I’ll have to give this a go on a multiserver system and check what the deal with Feature Receivers really is.