Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Add files to a site definition

  Asked By: Robin    Date: Aug 17    Category: Sharepoint    Views: 1315

I am creating a custom site definition with a custom document library.
I have succeeded in accomplishing this part.

How can I automatically add the following 3 files to the forms folder
that is automatically created when creating a document library:
template.doc, template.xls, template.ppt?

I am guessing that there might be some code that can be added to the
modules section of the onet.xml file, but I'm not sure how to do that.



5 Answers Found

Answer #1    Answered By: Chadd Hahn     Answered On: Aug 17

In your custom site  definition fpolder look in the %systemdrive%\Program Files\Common Files\Microsoft Shared\web server extensions\60\TEMPLATE\1033\[YOURSITEDEFINITIONNAMEHERE]\DOCTEMP/DOCTEMP subfolder. There are folders for each type of the Document Template;e.g., the PPT folder contains PPTTMPL.POT; the WORD folder contains WDTMPL.DOC; the XL folder contains XLTMPL.XLS.

Answer #2    Answered By: Cheryl Kelley     Answered On: Aug 17

But that was not what I was looking for. I understand that the template files  are kept there; however
currently, when I create a document  library from a customized site
definition a forms  folder is automatically  created that can be seen
in explorer view from the document library. This folder contains
several very important files and the template  for the default
application you select. So, if you select Word, the template file
located in the folder is template.doc

I would like 3 templates to automatically appear in the folder just
as the default does. I think you might be able to get them there by
adding a module, but I don't know how to access the proper url and
path for a new document library  or the coding used to add  the files
or the correct syntax to have the files in the folder you reference
below copied to a different file  type.

Answer #3    Answered By: Kalyan Pujari     Answered On: Aug 17

I am interested in using the schema and onet
files of the customized site  defintion rather than using a template
for better control.

I was able to add  the files  by adding another DocumentTemplate
definition that included multiple template  files.

<DocumentTemplate DisplayName="Multiple Office Documents"
Type="507" Default="TRUE" Description="Multiple office documents.">
<DocumentTemplateFile Name="doctemp\word\wdtmpl.doc"
TargetName="Forms/template.doc" Default="TRUE"/>
<DocumentTemplateFile Name="doctemp\xl\xltmpl.xls"
TargetName="Forms/template.xls" Default="FALSE"/>
<DocumentTemplateFile Name="doctemp\ppt\pptmpl.pot"
TargetName="Forms/template.pot" Default="FALSE"/>
TargetName="Forms/_webpartpage.htm" Default="FALSE"/>

All the Microsoft Application template files are now automatically
added to the forms  folder. The only problem that now exists is that
I am unable to generate a Web part  Page. If attempting to generate
via Documents and Lists, the page does not generate because a
document library  is not available to store it; If clicked on in the
drop down list, it does not generate.

Answer #4    Answered By: Jagdish Joshi     Answered On: Aug 17

The template.doc is generated from the WRTMPL.DOC in the DOCTEMP folder. Why do you want three different templates in one library? Only one will be used when a user clicks on 'New Documet.'

Answer #5    Answered By: Shara Johnson     Answered On: Aug 17

I restructured the schema file  for the customized doclib list so that
a user has a choice when he creates a new document. There is a down
arrow on the new document  portion of the menu bar where a user can
select a Word, Excel or Power Point document when creating  a new

If I manually add  the templates to the folder, there is no problem,
the user can select the desired application and the template  is found
and loaded. However, I don't want the user to have to manually load
the templates into the forms  folder each time he creates a new
document library  with our customized definition.

If I do not add the templates, the selected application still opens
with a default document; however, there are error messages that the
users needs to bypass indicating that the template cannot be located.
This looks pretty ugly. So, that is why I am trying to figure out how
to automatically  get the templates into the forms folder when the
folder is generated.

Didn't find what you were looking for? Find more on Add files to a site definition Or get search suggestion and latest updates.