Create Feature to Upload Site Template File (.stp) in MOSS

别来无恙 提交于 2020-01-15 06:09:10

问题


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/">
  <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/">
  <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


回答1:


This elements.xml works:

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <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.




回答2:


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



来源:https://stackoverflow.com/questions/1532642/create-feature-to-upload-site-template-file-stp-in-moss

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!