2

Following is the process I followed to create a Custom Web Template based on Team Site in SP 2013. I opened VS 2012 created an "empty SharePoint project", added an "Empty Element", changed its elements.xml file as follows and added a copy of onet.xml from 15Hive\TEMPLATE\SiteTemplates\sts\xml to the "empty element", changed the deployment type property of the onet.xml file to ElementFile. I Added a web scoped feature to the project and deployed it. elements.xml:

<?xml version="1.0" encoding="utf-8"?>
 <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <WebTemplate
    Name="Same_Name_as_EmptyElement"
    BaseTemplateName="STS"
    BaseTemplateID="1"
    BaseConfigurationID="0"
    Title="MyTeamSite"
    Description="blah"
    DisplayCategory="MyTemplates"/>
 </Elements>

Everything works great, When I want to create a new sub site, I can find my template and create a new Sub Site based on it. But the page is empty. There is no Promoted Links, or Documents Library, nothing. SitePages/Home.aspx is completely empty. why? and how Can I solve it? thanks for helping me.

2 Answers 2

1

This is as @suren says due to the fact that you do not provision a default page with your onet.xml

If you do not want to customize the default page you can activate the WikiPage HomePage Feature, it is a web scoped feature, so add it under <WebFeatures> in your onet.xml

    <!-- WikiPageHomePage Feature -->
    <Feature ID="00BFEA71-D8FE-4FEC-8DAD-01C19A6E4053" />

To make your new site have all the abilities of a standard teamsite you would need to activate the following features:

      <SiteFeatures>
        <!-- BasicWebParts Feature -->
        <Feature ID="00BFEA71-1C5E-4A24-B310-BA51C3EB7A57" />
        <!-- Three-state Workflow Feature -->
        <Feature ID="FDE5D850-671E-4143-950A-87B473922DC7" />
      </SiteFeatures>
      <WebFeatures>
        <!-- TeamCollab Feature -->
        <Feature ID="00BFEA71-4EA5-48D4-A4AD-7EA5C011ABE5" />
        <!-- MobilityRedirect -->
        <Feature ID="F41CC668-37E5-4743-B4A8-74D1DB3FD8A4" />
        <!-- WikiPageHomePage Feature -->
        <Feature ID="00BFEA71-D8FE-4FEC-8DAD-01C19A6E4053" />
        <!-- SiteNotebook Feature -->
        <Feature ID="F151BB39-7C3B-414F-BB36-6BF18872052F" />
        <!-- Getting Started List instance -->
        <Feature ID="4AEC7207-0D02-4f4f-AA07-B370199CD0C7" />
        <!-- MDS -->
        <Feature ID="87294C72-F260-42f3-A41B-981A2FFCE37A" />
      </WebFeatures>

You find this in the ONET.XML found in 15/TEMPLATE/SiteTemplates/sts/xml

Edit:

If you want a default page just like the one for a Team Site, with webparts and all:

  1. Add a module to your project
  2. Add that one to a feature that is web scoped and activate it in the ONET.XML webscoped features.
  3. In the module, add the default.aspx from 15/TEMPLATE/SiteTemplates/sts/
  4. In the Elements.xml of the module add the following (substituting the module name and file path to match your module):

    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
      <Module Name="ProjectDefault" Url="" Path="">
        <File Path="ProjectDefault\default.aspx" Url="default.aspx" NavBarHome="True">
      <AllUsersWebPart WebPartZoneID="Top" WebPartOrder="1">
        <![CDATA[
                        <webParts>
                            <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
                                <metaData>
                                    <type name="Microsoft.SharePoint.Portal.WebControls.ProjectSummaryWebPart, Microsoft.SharePoint.Portal, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
                                    <importErrorMessage>$Resources:spscore,WPImportErrorMessage;</importErrorMessage>
                                </metaData>
                                <data>
                                    <properties>
                                        <property name="Title" type="string">$Resources:spscore,ProjectSummaryWebPartTitle;</property>
                                        <property name="Description" type="string">$Resources:spscore,ProjectSummaryWebPartDescription;</property>
                                        <property name="ChromeType" type="chrometype">None</property>
                                    </properties>
                                </data>
                            </webPart>
                        </webParts>
                    ]]>
      </AllUsersWebPart>
      <AllUsersWebPart WebPartZoneID="Left" WebPartOrder="1">
        <![CDATA[
        <WebPart xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/WebPart/v2">
      <Title>Site Feed</Title>
      <FrameType>None</FrameType>
      <Description>Site Feed contains microblogging conversations on a group site.    </Description>
      <IsIncluded>true</IsIncluded>
      <ZoneID>Left</ZoneID>
      <PartOrder>0</PartOrder>
      <FrameState>Normal</FrameState>
      <Height />
      <Width />
      <AllowRemove>true</AllowRemove>
      <AllowZoneChange>true</AllowZoneChange>
      <AllowMinimize>true</AllowMinimize>
      <AllowConnect>true</AllowConnect>
      <AllowEdit>true</AllowEdit>
      <AllowHide>true</AllowHide>
      <IsVisible>true</IsVisible>
      <DetailLink />
      <HelpLink />
      <HelpMode>Modeless</HelpMode>
      <Dir>Default</Dir>
      <PartImageSmall />
      <MissingAssembly>Cannot import this Web Part.</MissingAssembly>
      <PartImageLarge />
      <IsIncludedFilter />
      <Assembly>Microsoft.SharePoint.Portal, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
      <TypeName>Microsoft.SharePoint.Portal.WebControls.SiteFeedWebPart</TypeName>
     </WebPart>]]>
      </AllUsersWebPart>
     <View List="$Resources:core,shareddocuments_Folder;" BaseViewID="1" WebPartZoneID="Right" />
    </File>
    

10
  • thank you, I have copied a complete onet.xml from 15/Template/siteTemplates/STS/xml. and the wiki feature is activated (for our case it must be). And I have copied default.aspx and defaultdws.aspx to the "empty element" to be provisioned.those features you mentioned are activated. still geting empty site.
    – Medes
    Commented Jul 8, 2013 at 7:55
  • Yes I know, when the wiki page is activated it goes to sitepages/home.aspx so there is no need for default.aspx
    – Medes
    Commented Jul 8, 2013 at 11:42
  • yes this solves the problem if you browse to <code>TeamSite/default.asxp</code> but you usually go to htt://teamsite and it automatically redirect you to sitePages/home.aspx which still is empty. obs. I have provisioned default page.
    – Medes
    Commented Jul 8, 2013 at 12:18
  • OK, so you have a default page, but it's not at the correct URL? Commented Jul 8, 2013 at 12:19
  • no, I don't mean that. please can you test and browse to a team site by typing htt://yourTeamSite and see what happend. sharePoint adds sitepages/home.aspx to your url
    – Medes
    Commented Jul 8, 2013 at 12:21
0

I have created web template by following this link. Please see if you have done everything.

I think you copied onet.xml alone.

https://usmanmughal.wordpress.com/2011/04/26/how-to-create-web-template-in-sharepoint-2010-using-feature/

3
  • Thank you very much for your answer. Yes you are right I copyed only onet.xml. I must ask you something before I test it and come back. The above link says that I must copy default.aspx and defaultdws.aspx as well. my problem is about SitePages/Home.aspx not default.aspx. because Team Site uses wiki pages by default. isn't it? the web parts do not appear on home.aspx not default.aspx.
    – Medes
    Commented Jun 24, 2013 at 11:41
  • If we use sts template, we should copy all 3 files.
    – Suren
    Commented Jun 24, 2013 at 13:07
  • Thanks again,I copied all three files and checked they are deployed, but I have still same problem. the home.aspx is still empty. The Text layout of the sites created based on my template contains only one td (table cell) but created sites based on the oob team site has two tr and three td.
    – Medes
    Commented Jun 24, 2013 at 14:12

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.