1

I have a Branding feature where I set the Master Page and then the Theme programmatically. When applying the theme, the operation takes a couple minutes. It iterates through SubSites so if there are 100 subsites, it takes up to 30 minutes to apply branding. This is not efficent and it will actually time out if the feature is activated through the browser

  foreach (SPWeb web in site.AllWebs)
        {
            try
            {
                if (!web.IsAppWeb) 
                {
                    web.MasterUrl = masterUrl;
                    web.CustomMasterUrl = masterUrl;
                    web.Update();

                    //This line takes forever!
                    web.ApplyTheme(themeUrl, "", "", true);

                }
            }
            catch (Exception ex)
            {
            }
        }

Is there an alternative to web.ApplyTheme()? Or should I eliminate it all together and have any core styles in my custom style.css?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.