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

I created a WebTemplate in Visual Studio and deployed it as a farm solution (I couldn't create a sandbox solution because it needs to deploy a custom master page and other stuff to the GAC). Now it shows up both in Central Admin, on the create site collection page and within existing site collections, on the Create a site page. I want it to be available only when creating sub-sites; I don't want it to be used for a root site.

Is this possible? How?

UPDATE:

as per Naim's answer, I tried adding SubWebOnly="TRUE" in the ONET.XML inside the <Configuration> tag, but the template still shows up in Central Admin Create site collection page

share|improve this question
add comment

1 Answer 1

Go to your Web Template File inside …/TEMPLATE/LCID/XML

There is an attribute SubWebOnly in the Configuration element of the template. Set that attribute to TRUE and the template should show only when creating subsites.

<Template Name=" " ID="">
    <Configuration ID=""
               Title=""
               ...
               ...   
               SubWebOnly = "TRUE" 
               >
</Configuration>

share|improve this answer
    
How can I do this in Visual Studio directly? I don't want to force users of my WebTemplate to manually edit the configuration after that it is has been deployed. Also, the WebTemplate is deployed by a farm feature –  MdMazzotti Jan 15 at 10:41
    
You have your web template in Visual Studio right? In the web template file (mapped folder to .../TEMPLATE/1033/XML) add SubWebOnly attribute to the configuration element. Users don't have to change it, it will be in the SharePoint Root folder when you install your feature. –  Naim Jan 15 at 10:47
    
I don't have the mapped folder. The template elements.xml and onet.xml files deploy to {SharePointRoot}\Template\Features\{FeatureName}\MyTemplateName\ –  MdMazzotti Jan 15 at 10:50
    
This works with custom site definitions but It’s possible to not work with WebTemplate. In your WebTemplate element you use OOB site definition in BaseTemplateName, BaseTemplateID and BaseConfigurationID . That OOB site definition has SubWebOnly false by default. Two things you can try: 1. Use SubWeb=”TRUE” in the WebTemplate element (MSDN is not very clear what this attribute's purpose). Or 2.Create a simple site definition,in its <Configuration> element set SubWebOnly=”TRUE”. Then in WebTemplate element set BaseConfigurationID to this new site definition. Let us know if you got it working. –  Naim Jan 15 at 21:33
    
Last option is to go with custom site definition altogether. Each has its pros and cons. Check this article. –  Naim Jan 15 at 21:37
add comment

Your Answer

 
discard

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

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