Logo 
Search:

MOSS Forum

Ask Question   UnAnswered
Home » Forum » MOSS       RSS Feeds

Adding Content to Document Library from Site Definition

  Asked By: Angelique    Date: Dec 18    Category: MOSS    Views: 3775

I have a need to add content to a document library using the site
definition. Basically, when the site is provisioned from my custom site
definition i would like to have the equivalent of a handful of word or
PDF documents loaded into the library. I have seen many examples of
adding content to link lists and contact lists but nothing like adding
a document to a document library. Is this possible or is there a better
way to do this than what i am thinking of?

Share: 

 

7 Answers Found

 
Answer #1    Answered By: Octavio Dotson     Answered On: Dec 18

You could save the site  as a template with Content. Then when you create sites
based on that template they will have the documents  already added.

 
Answer #2    Answered By: Judy Pittman     Answered On: Dec 18

I am currently using that approach but i am adding  additional
customizations that, as far as i am aware, are only available when
creating a custom site  definition (custom .resx, .css. js files). Is
there another possible solution?

 
Answer #3    Answered By: Tricia Mullins     Answered On: Dec 18

You should be able to either create a <module> element in the site
definition to move ghostable or actual copies of the files into the
document library. I've done this to add  custom master pages to a
gallery. If that doesn't work because you are creating the library  in
that site  definition you should be able to create a feature to do the
same thing. Then activate the feature in the site definition.

I'll see if I can rough it out and do a BLOG on the actual code. If it
works I'll let you know where the BLOG is posted.

 
Answer #4    Answered By: Himanshu Gohil     Answered On: Dec 18

I think i have found the solution to my issue. I will share the code
below if anyone is interested. Let me know if anyone has any suggestions
for improvement.

This is the <List> node from the configuration section in ONET,xml. It
is for a document  library.

<List FeatureId="00BFEA71-E717-4E80-AA17-D0C71B360101"
Title="My Documents"
Type="101"
QuickLaunchUrl="MyDocuments/Forms/AllItems.aspx"
Url="MyDocuments" />

This is the <Module> element from the modules section of the same
onet.xml file. It loads a file called 'test.txt' into the My Documents
library when the site  is provisioned.

<Module Name="MyDocument" Url="MyDocuments" Path="">
<File Url="test.txt" Type="GhostableInLibrary"/>
</Module>

this test.txt file is sitting in the same location as the default.aspx
file in the TEMPLATE\SiteTemplates\MySiteDefinitionName folder.

 
Answer #5    Answered By: Ashton Schroeder     Answered On: Dec 18

If you're using WSS v3 or MOSS 2007 you might be able to create a feature that
adds those files to a document  library and then staple that feature to your site
definition.

 
Answer #6    Answered By: Iris Ballard     Answered On: Dec 18

Does anyone know if it is even possible to add  a word  or PDF file to a
document library  when it is provisioned?

 
Answer #7    Answered By: Jamila Guthrie     Answered On: Dec 18

Yes. After you have all docs you need in a list, go to the list
settings, and save as a list template.

 
Didn't find what you were looking for? Find more on Adding Content to Document Library from Site Definition Or get search suggestion and latest updates.




Tagged: