Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Apply Theme by default

  Asked By: Sanchay    Date: Dec 02    Category: Sharepoint    Views: 8672

Is there any way to apply a theam by default on creation of a new
site? so, that we don't have to apply a theme manually under Site
Settings link.



23 Answers Found

Answer #1    Answered By: Isidro Berger     Answered On: Dec 02

Yes, you will have to modify the ows.css file team site, you can create custom ows.css file and overrides the class attributes. sps.css is for portal, owspers.css is for MySite.

Answer #2    Answered By: Schuyler Le     Answered On: Dec 02

I think i am not able to explain problem.
SharePoint provied few theme  and in order to apply  them we have to
go to Site Settings and apply them. Mine question is "Is there any
way in which we can apply a theme at the time of site creation?"

Answer #3    Answered By: Kristina Cox     Answered On: Dec 02

No, unfortunately not................

Answer #4    Answered By: Kalyan Pujari     Answered On: Dec 02

Not true. A site def has an executeUrl value which can be your own aspx
page. On this page you can write .NET code to call the SharePoint API and
apply a theme  to the site. I do it all the time to facilitate this kind of

Answer #5    Answered By: Willard Valenzuela     Answered On: Dec 02

This is really helpful. But after doing all modifications in
Onet.xml, i am facing one problem, the new page that i have created
is throwing a "External component error"
And which kind of things i should keep in my mind while creating a
new page.

Answer #6    Answered By: Allison Stewart     Answered On: Dec 02

I stand corrected. You got a post about it by chance?

Answer #7    Answered By: Michelle White     Answered On: Dec 02

Haven't done one, but added it to my "Make a post about this someday" list.
Feel free to beat me to the punch if you want as I probably won't get to it
for a few days.

Answer #8    Answered By: Gopal Jamakhandi     Answered On: Dec 02

If you wanted to expand on his article it might be helpful to discuss
how to work around the HTTP GET requirements, in order to use more
advanced code on the redirected page.

Answer #9    Answered By: Jaime Weaver     Answered On: Dec 02

Oh yeah, forgot about the RPC methods. There is an applytheme or something
method so you might be able to do that as well.

Answer #10    Answered By: Anibal Baird     Answered On: Dec 02

But it is safe to say this is not possible out of the box, there is not
an admin setting somewhere to do this. I have fielded that inquiry

Answer #11    Answered By: Karla Morrison     Answered On: Dec 02

Here's a simple way to apply  themes automatically. It's a bit tedious, but requires no programming. I tried this on WSS (took about 2 minutes), haven't tried Portal.

1. Back up your original template files!
2. Create a subsite for each template that you use
3. Apply the theme  to the site
4. Save the site as a template over top of your existing templates (if you want to force use of theme)
5. Delete the subsites that you just created

Answer #12    Answered By: Patricia Richardson     Answered On: Dec 02

The only problem with this is that the “theme” is actually hardcoded into the template. Really. Go ahead and remove the theme  from the system (completely, remove the theme directory and the entry in webthemes.xml). Do an IISRESET to flush the cache. Create a new site using the template. Bingo. It uses the “theme” so if you ever updated that theme, those sites wouldn’t get the new theme applied.

Although, I do agree that saving a site as a template will do this for you, it also means all sites are running from the database and not the file system which can become a performance hog if left unchecked. 10,000 sites running from a .stp file is sure to be a bigger burden to your system then 10,000 sites running from the file system.

Answer #13    Answered By: Alexandra Patterson     Answered On: Dec 02

> The only problem with this is that the “theme” is actually hard coded into the template.

I thought that this was what they wanted. I just checked, and was able to apply  a new theme  to the "hard-coded" template. I can also apply a new template to existing sites. Obviously this creates some additional work if I change themes, but at least I'm not stuck with the old theme. Clearly something to consider before going down this path, though.

> it also means all sites are running from the database and not the file system which can become a performance hog if left unchecked.

People refer to the "unghosted" problem a lot, but I'm not sure how concerned to be about this. I suspect that most implementations don't come anywhere near 10,000 sites/subsites. Ours has been running for two years with ~1000 users, and we have barely broken 1000 pages. I am curious to see what numbers others are running today. Has anyone seen any performance data published on the relative difference between "ghosted" and "unghosted" servers?

This is an interesting thread. I learn a lot from these discussions!

Answer #14    Answered By: Christop Mcfadden     Answered On: Dec 02

I know that the theme  will be (somehow) part of the site, even if the theme doesn’t exist on the site. I didn’t realize you can re-apply the theme (or set a new one) but that makes sense.

Answer #15    Answered By: Stefanie Ruiz     Answered On: Dec 02

You apply  a theme  programmatically immediately after a Web is
provisioned using the ExecuteUrl element. Since questions about how to
do this keep coming up, I've attached to this post an ASPX page that
should serve as an example of how to use ExecuteUrl, in this case to set
a new Web's theme to "Slate". The line that sets the theme is untested
but it will likely work; I use the rest of the solution all the time.

The following code is needed to include the PostWebCreationCode.aspx
page in your site definition (obviously both of these sections will
likely contain other elements and you may want to include some lists in
your configuration but I've shortened it up for brevity):

<Configuration ID="0" Name="Default">
<!-- List elements removed for brevity -->
<Module Name="Default"/>
<Module Name="WebPartPopulation"/>
<Module Name="AddRootFiles"/>
<ExecuteUrl Url="PostWebCreationCode.aspx" />
<Module Name="AddRootFiles" Url="" Path="">
<File Url="PostWebCreationCode.aspx">
<!-- Default and WebPartPopulation modules removed for brevity

Answer #16    Answered By: Damon Garner     Answered On: Dec 02

See my previous post wrt ExecuteUrl.

Answer #17    Answered By: Royce Orr     Answered On: Dec 02

Unghosted pages take a 15-20% performance hit. For infrequently visited
pages, this can be unimportant. For frequently visited pages, this can
be substantial. See my post about other problems with unghosting:

Answer #18    Answered By: Laura Walker     Answered On: Dec 02

I didn't think that Webs provisioned using an STP had any reference back
to the custom template that was used to provision them. Are these Webs
really "running from an .stp file" in the database? I've never research

I typically think of the changes saved in a custom template like a diff
of the original site definition. When a new Web is provisioned using an
STP, the site definition upon which it is based is used initially to
provision the Web and then smigrate instructions are run like a macro to
alter the new Web to make it look like the Web that was used to create
the custom template did when the snapshot was taken. <breathe />

Answer #19    Answered By: Nina Banks     Answered On: Dec 02

That's what I think but in situations where I've done this (used an .stp
file for creating a new site) it's had the theme  applied even when it didn't
exist on the server. At least that's what I remember, now of course I'll
have to go back and try it again to make sure I'm not loosing my mind.

Answer #20    Answered By: Renee Murray     Answered On: Dec 02

Perhaps some theme  details are kept as metadata in the database (I know
that the theme name is kept in the Webs table). I don't use themes much;
OWS.CSS overrides are so much better.

Answer #21    Answered By: Harshini Raju     Answered On: Dec 02

I gave all the code you needed for the page in my previous post:

Answer #22    Answered By: Christop Mcfadden     Answered On: Dec 02

This work fine but in c# code i have to replace following line of

web.Theme = "aftrnoon";

with these


After this worked fine for me.

Answer #23    Answered By: Gopal Jamakhandi     Answered On: Dec 02

I said that I was guessing on the theme  line........

Didn't find what you were looking for? Find more on Apply Theme by default Or get search suggestion and latest updates.