SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

Greetings...

Well, the title pretty much says it all. Users will be able to create numerous new team sites, and I need to make sure that custom theme and css are automatically applied. Also, I need to deploy custom masterpage which links to my custom css.

I'm not a programmer but a designer, so this is proving to be a problem for me. All the references that I've found say that it can be easily done by a feature, but I can't find the code that I could just copy/paste. Is there a mercyful soul around that can provide such a thing for a lost SP rookie?

From what I understand, I need a feature.xml file and .feature file + custom .thmx, .css and .mastepage files. I have created the last three, and I'm looking for help concerning the first two.

Thank you...

share|improve this question

I am no developer as well but I think the expression you are looking for is "staple feature". However, I am pretty sure that you want to involve someone with DEV-skills into that project ;)

See:

http://sharepointmagazine.net/articles/introduction-to-sharepoint-feature-stapling-part-1 http://sharepointmagazine.net/articles/introduction-to-sharepoint-feature-stapling-part-2

share|improve this answer

You can create a new Event receiver (in your Visual Studio project there is an Event Receiver template when you create a new item in your project) that attaches to the WebProvisioned event, essentially executing every time a site is created, checking if the currently created site is a team site and if it is, applying your master page and theme. Sample below

public class YourLookAndFeelProvider : SPWebEventReceiver
{
    /// <summary>
    /// Applies styling customisations to the site at the provision time. 
    /// </summary>
    public override void WebProvisioned(SPWebEventProperties properties)
    {
        var web = properties.Web;
        var webCustomisationsHelper = new SPWebCustomisationsHelper(web);

        if (web.WebTemplate.Equals("STS"))
        {
           // Apply the custom master page
           webCustomisationsHelper.ApplyMasterPage("yourmasterpage.master");
           // Apply the theme
           ThmxTheme.SetThemeUrlForWeb(web, "your team server relative Url"); 
        }
    }
}

Your custom css can be registered in the master page header.

Hope this helps.

share|improve this answer

Your Answer

 
discard

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