Experiences applying SharePoint Themes to a SharePoint Farm

So I have already written this blog post once, but Windows Update decided to reboot as I was finishing the blog post. Unfortunately I hit Ctrl + V as it asked if I wanted to save the post – then it rebooted.

Windows Live Writer has an auto save post function, I have now enabled this to save further frustrations. Shame it’s not on by default!

Anyway so what did I write..?

I have been recently updating some themes that have already been deployed to a SharePoint farm. I thought the process would be pretty straight-forward as the files were already packaged up as a WSP. I thought the process would be something like this:-

  • update theme.css within the theme folder
  • package up the changes into a WSP file
  • update the solution with stsadm –o updatesolution

Unfortunately this wasn’t the case.

So what happened? Well I updated the solution and loaded up the SharePoint site and nothing had changed. “Ah ha” I thought it’s probably because IE is caching the CSS file. So pressed CTRL+F5 to expire the cache the page loaded again with no change.

Using the IE developer toolbar I selected the element and used trace style to find out why the CSS class hadn’t changed. The toolbar opened up a strangely named CSS file called ITSP1001-65001.css. Looking at the CSS styles I could see that yep, the style hadn’t changed.

So what the heck was this file? I certainly hadn’t created it and its not in my THEME folder inside c:\program files\common files\microsoft\web server extensions\12\template\themes\THEME.

After some investigation and reading a couple of blog posts such as this one from Shane Perran’s blog site. (http://www.graphicalwonder.com/?p=419)

I discovered that the file is automatically created when a theme is applied.

So what happens? Well SharePoint merges the following css files:-

  • core.css
  • [alternative css file for your site definition]
  • theme.css

This creates a file using the first 4 letters of the THEME name with 1001-65001.css  appended to the end. This file along with the rest of the files from the Theme folder is uploaded into a folder _theme/THEMENAME found at the root of the site. You can see this folder in SharePoint Designer.

So because this file is only created when you apply a theme that is why it was not updated when the solution updated. So I applied the theme again and still no luck!

It turns out that you need to apply another theme first such as CLASSIC and then reapply your custom theme.

Tada the theme is now updated!

Unfortunately the process of reapplying the theme is tedious but fortunately Gary LaPointe’s stsadm extensions came to the rescue in the form of stsadm –o gl-applytheme (http://stsadm.blogspot.com/2008/01/apply-theme.html).

The following stsadm commands were used:-

  • stsadm –o gl-applytheme –theme CLASSIC –url [http://sharepoint]
  • stsadm –o gl-applytheme – theme THEMENAME –url [http://sharepoint]

Once all the changes had been made then all the sites needed to be updated, not a fun task! Once again the stsadm –o gl-applytheme came to the rescue in the form of a recursive option.

Using the stsadm command with the recursive option all the SharePoint site collection were updated in no time.

I hope that this post helped, if you have any questions or there is something that you need more info on then just leave a comment.

Thanks for reading


One Comment

Thoughts? Comments about this post? Please leave them here..

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.