26 October 2005

Pre-populating a document library with pages/files using ONET.XML

I recently came across a forum post that indicated that this wasn't possible - well just keep those challenges coming :)

It IS possible to pre-populate a Document Library with files.

Here goes (this adds a Web Part Page to a Document Library - obviously you could create a Document Library where the default page template is a Web Part Page)

1. in your ONET.XML add a module under your existing Default module
2. The name can be whatever
3. Use the List ID from whichever Library you want your docs or pages to go to (look earlier in the ONET file for this) - Shared Documents in STS is 101 by default, likewise use the Url to specify the URL of the Document Library
4. specify the Path to where your source files are (relative to the root Site Definition in the file system)

<Module Name="randomNameForModule" List="101" Url="Shared Documents" Path="DOCTEMP\SMARTPGS">

5. you can then add FILE elements for each file

<File Name="NewDocument.aspx" Url="spstd1.aspx" Type="GhostableInLibrary" >

... at this point you can also add web parts to web part pages using the AllUsersWebPart element

6. Include the module in the Configuration (usually the one with ID="0" Name="Default" - if you made a copy of the STS Site Def and just modified the default Team Site config)

voi la

the only gotcha I have found so far is when trying to add these new pages to a NavBar in ONET.XML - it seems that SharePoint uses one set of NavBars and FrontPage another (not quite, but it can appear that way) - I think it is problematic due to ghosting.

 

Comments

# cjwalker said:
original forum post on this topic
25 October 05 at 6:33 PM
# Dog Breeding &raquo; Pre-populating a document library with pages/files using ONET.XML said:

PingBack from http://dogs-pets.info/dog-breeding/?p=378

22 April 08 at 12:02 PM
Anonymous comments are disabled
Page view tracker