Programmatically add a site template (.stp) to SharePoint

I would like to programmatically add a custom site template (.stp file) to the MOSS community site collection as part of my build process. Can anyone point me to a better way to do this?

Thank you MagicAndi.

+1


source to share


3 answers


The way to do this with a function would be using a File Element . STP files live in /_catalogs/wt

, so this type of function will load the file.

Update: More details in Create a function to load a site template file (.stp) into MOSS , but elements are presented here for completeness. XML:



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

      

+2


source


It looks like there is a simple batch file for this, calling the STSADM tool with the -AddTemplate parameter. Command:

stsadm -o addtemplate -filename c:\template.stp -title "Template Title" -description "Template Description"

      

You can also delete an existing template using the command:



stsadm -o deletetemplate -title "Template title" 

      

See the article for details .

+2


source


to be more precise: "stsadm -o addtemplate" adds a site template to the central template gallery "not to a specific MOSS team site, ie in the gallery family template "; I think this could be a significant difference in some (large) environment where it might be appropriate to narrow the available template to a sitecollection.

Installing Application Templates for Windows SharePoint Services 3.0

0


source







All Articles