Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

custom template ID?

  Asked By: Fredrick    Date: Jan 31    Category: Sharepoint    Views: 3106

When I create sites using c# programming, how can I find the custom
template ID?
For example, team site is STS#0, blank site is STS#1..

I need template ID in using " webApplication.Sites.Add"
I did "save as site template" in site setting. But I can't find my own

Any help?



7 Answers Found

Answer #1    Answered By: Stefanie Ruiz     Answered On: Jan 31

STS#0 means the STS folder under ..\12\TEMPLATE\SiteTemplates and the 0
means Configuration 0 (zero) in

So, if your custom  Site Definition is in a folder called XYZ under
..\12\TEMPLATE\SiteTemplates and you want to use Configuration 2 in
..\12\TEMPLATE\SiteTemplates\XYZ\XML\ONET.xml you would use:

Answer #2    Answered By: Damon Garner     Answered On: Jan 31

Where did it save custom  template which is "save as template" in site

Answer #3    Answered By: Matt Prince     Answered On: Jan 31

Sorry, I missed the fact that you saved the site  as an SharePoint
Template Package (STP).

Answer #4    Answered By: Brooks Bond     Answered On: Jan 31

STS#0 is based on the site  Definition being in the STS directory. Team
site is Configuration ID 0 and blank  Site is Configuration ID 1. But
since you saved your site as a template  it won't be in the Site
Templates directory of the 12 hive. That's only for Site Definitions.
It will be in the Site Template Gallery of the top level web site of the
Site collection where you saved it. You will need to get the Template
ID programattically. You can call the GetCustomWebTemplates method of
an SPsite object to get a collection of site templates available. Step
through that collection until you find  the site template with the Name
you gave yours. Get the ID of that SPWebTemplate object. That is the
template ID you want.

Answer #5    Answered By: Gregg Wilkinson     Answered On: Jan 31

I had a little time, so I put the necessary code into an STSADM
extension. It can be downloaded (for now) from my blog:

Please let me know how it works. Thanks.

Answer #6    Answered By: Darrel Sexton     Answered On: Jan 31

I can't download your file..
I did it with a different way.

stsadm -o addtemplate -filename \sitetemplate.stp - title sitetempalte
stsadm -o enumtemplates

then I can find  the ID like _GLOBAL_#1

Answer #7    Answered By: Tory Sellers     Answered On: Jan 31

You clicked on the .stp file in the gallery list and saved it locally,
right? I would like to understand so my extension documentation can list
all alternatives.

Didn't find what you were looking for? Find more on custom template ID? Or get search suggestion and latest updates.