1

I got a on-premise Sharepoint 2013 15.0.4569.1506 site collection with a custom master page. All the sites inherit master page, theme and CSS. They also inherit Navigation, which is a simple termset. All of this work very well if I create out of the box sites.

But... now we want to create over 300 documentation sites with some apps, enabled features and a customized default page. And I want to make this as a template. A simple request, but how?

As far as I can see custom master page don't work without Publishing feature, and the Publishing feature are not supported if you want to make a template of a site.

Anyone got a tip?

/Steinar

1 Answer 1

0

It is true that you need to deactivate the publishing feature to save site as template but if you are going to use the template using the code than after creating the site you can activate publishing feature programmatically.

You can get a reference from below mentioned code.

public class Feature1EventReceiver : SPFeatureReceiver
{
    public override void FeatureActivated(SPFeatureReceiverProperties properties)
    {
        SPSite siteCollection = properties.Feature.Parent as SPSite;
        if (siteCollection != null)
        {
            SPWeb topLevelSite = siteCollection.RootWeb;

            ActivateSharePointServerPublishingInfrastructureFeature(topLevelSite);
        }
    }

    private static void ActivateSharePointServerPublishingInfrastructureFeature(SPWeb topLevelSite)
    {
        // activating the Sharepoint Server publishing Infrastructure feature at the site collection
        string pubFeatureID = "F6924D36-2FA8-4f0b-B16D-06B7250180FA";
        Guid PublishingInfraFeatureID = new Guid(pubFeatureID);
        topLevelSite.Features.Add(PublishingInfraFeatureID, true, SPFeatureDefinitionScope.Site);
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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