Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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
add comment

2 Answers

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
add comment

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
add comment

Your Answer

 
discard

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