views:

1532

answers:

2

Hi,

Following on from this question, I have created a feature to upload an site template file as part of an automated build of a SharePoint site. However, while the feature deploys the .stp file correctly to the hive, and the solution appears in the CAS | Operations | Solution Management page, the site template does not appear in the site template gallery as expected. I have given the contents of the feature.xml and elements.xml files below; can anyone spot where I am going wrong?

feature.xml

<?xml version="1.0" encoding="utf-8"?>
<Feature  Id="59627434-4B75-4f9c-B830-E6E34007DA70"
          Title=" Team Site Template"
          Description="UKTI Connect Team Site Template"
          Version="12.0.0.0"
          Hidden="FALSE"
          Scope="Web"
          DefaultResourceFile="core"
          xmlns="http://schemas.microsoft.com/sharepoint/"&gt;
  <ElementManifests>
    <ElementManifest Location="elements.xml"/>
    <ElementFile Location="TeamSiteTemplate.stp" />
  </ElementManifests>
</Feature>

elements.xml

<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/"&gt;
  <Module Name="TeamSiteTemplate" Url="_catalogs/wt" RootWebOnly="TRUE" >
      <File Url="TeamSiteTemplate.stp" Type="GhostableInLibrary" IgnoreIfAlreadyExists="FALSE">
        <Property Name="LanguageDisplay" Value="English" />
        <Property Name="Version" Value="3" />
      </File>
  </Module>
</Elements>

Thanks, MagicAndi

A: 

Have you tried setting the scope of the feature to Site?

Colin
Colin, Thanks but I have already tried setting the scope to Site without success. Thanks anyway.
MagicAndi
+1  A: 

This elements.xml works:

<Elements xmlns="http://schemas.microsoft.com/sharepoint/"&gt;
    <Module Name="TeamSiteTemplate" List="111" Url="_catalogs/wt">
     <File Url="TeamSiteTemplate.stp" Type="GhostableInLibrary">
      <Property Name="LanguageDisplay" Value="English" />
      <Property Name="Version" Value="3" />
     </File>
    </Module>
</Elements>

There are minor differences but the one that probably solves the problem is the inclusion of the List attribute.

To explain, in %CommonProgramFiles%\Microsoft Shared\web server extensions\12\TEMPLATE\GLOBAL\XML\ONET.XML see the line containing the words sitetemplategalleryList. This shows Type="111" which corresponds to List="111" in elements.xml.

Also note that I set the feature to Site scope as Colin suggested.

Alex Angas
Alex, accepted as answer. I had managed, with a colleague's help, to get the .wsp to deploy successfully by including an empty class file to update the .dll in the .wsp, even though the .dll itself was not deployed.
MagicAndi
Your solution is obviously much more acceptable!
MagicAndi
No problem! A feature receiver may have been another approach.
Alex Angas
Is the STP file in the same folder as the elements file?
Greg Ogle
@Greg: The `Path` and `Url` attributes are a bit of a black art in my experience. But from reading this XML again I think it should work if the STP is in the same folder as `elements.xml`.
Alex Angas