SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any way of catching when a theme is being changed -- so that I can fire a ThmxTheme.RemoveThemeFromWeb?

The option to change the theme is currently hidden in our farm, but we can't disallow themes in the web application or user policy or it causes certain other issues.

Are there any other advised options to prevent themes from being changed?

share|improve this question

There are third party tools, like Axceler ControlPoint that give this type of functionality. Their methodology is to use event receivers to detect these types of changes and to block them. Being in an O365 environment, I'm not certain if you'd have the ability to create an event receiver or not (haven't used the cloud version ever).

share|improve this answer
We can write all the custom code we need, it just goes through the MSOCAF validation process, etc. However, I have been thinking about utilizing an Event Receiver. – Quinn Johns Oct 28 '12 at 19:24
Would you be so kind as to provide a sample on how to check for this particular event in a event receiver? (Not using Axceler) – Quinn Johns Oct 31 '12 at 18:57
up vote 0 down vote accepted

To accommodate the issue, we did the following:

Since we weren't going to disable the privileges, we did the very best next thing - remove the problem.

We removed all the managed themes, via the following code in a site-scoped feature receiver, on feature activation.

if (properties != null)
    using (SPSite _SPSite = properties.Feature.Parent as SPSite)
        using (SPWeb web = _SPSite.RootWeb)
            ReadOnlyCollection<ThmxTheme> ManagedThemes = null;
            ManagedThemes = ThmxTheme.GetManagedThemes(web.Site);
            SPFile file = null;
            foreach (ThmxTheme themes in ManagedThemes)
                file = web.GetFile(themes.ServerRelativeUrl);

and then also disabled the following feature through feature stapling,

'Enhanced Theming' - GUID: 068bc832-4951-11dc-8314-0800200c9a66

Hopefully, this helps someone in the future. I've expanded on permissions/removal of themes at my blog.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.