Geeks With Blogs
Blog Moved to Blog Moved to
I am currently on a rather large SharePoint implementation and over time I have gathered a lot of tips and tricks for SharePoint.  Quite frankly, if you took any XML configuration files from SharePoint and really dissected it, it would take weeks to fully understand what each does. 
Today, I am writing about how to create a custom document library through the ListTemplate and such.  In my example, we will create a custom document library to store resumes from the standard document library on the personal site.  First off, what we need to do is browse to the <Install Drive>\Program Files\Common Files\Microsoft Shared\web server extensions\60\TEMPLATE\1033\SPSPERS directory.  From this directory, we will notice that there are several folders here, XML (which we will get into later) and LISTS. 
The next step is to browse into the LISTS directory.  Create a folder named "RESUMEDOCLIB".  Since this is a simple document library with not much documentation there, we will copy the contents of the DOCLIB folder into the newly created RESUMEDOCLIB.  Your new folder should have the contents of the following:
-  AllItems.aspx
-  DispForm.aspx
-  EDITDLG.htm
-  EditForm.aspx
-  FILEDLG.htm
-  Upload.aspx
-  webfldr.aspx
Before we get started, we need to make sure we are familiar with the field tables for default lists within SharePoint.  Here is a good list of them from Microsoft:
The file that we are interested in now is the SCHEMA.XML.  Open the file in a text editor (I prefer Textpad) and let's start going through it.  Locate the line with <List which is around line 4.  In this example, I will add a couple of fields to the list.  We will add, Resume Name, Resume Short Description and Resume Long Description.  Here is what it should look like when we are finished.
<List xmlns:ows="Microsoft SharePoint" Name="Documents" Title="Shared Documents" Direction="0" Url="Shared Documents" BaseType="1" >
      <Field Type="Text" Name="Title" ShowInNewForm="FALSE" ShowInFileDlg="FALSE" DisplayName="Title" Sealed="TRUE" />
      <Field Type="Text" Name="Resume_x0020_Name" ShowInNewForm="TRUE" ShowInFileDlg="TRUE" DisplayName="Resume Name" Sealed="FALSE" />
      <Field Type="Text" Name="Resume_x0020_Short_x0020_Description" ShowInNewForm="TRUE" ShowInFileDlg="TRUE" DisplayName="Resume Short Description" Sealed="FALSE" />
      <Field Type="Note" Name="Resume_x0020_Long_x0020_Description" ShowInNewForm="TRUE" ShowInFileDlg="TRUE" DisplayName="Resume Long Description" Sealed="FALSE" />
After adding these fields, we should also change the default view so that they can be easily viewed containing our new items.  Do a search for ViewFields within this document.   For me, it took me to line 984.  We need to modify the FieldRef tags to show the fields we want.  For example, we want to show DocIcon, LinkFileName,
Resume Name, Resume Short Description, Resume Long Description, Last Modified, Editor, and LinkCheckedOutTitle.  Here is what the XML should look like after we are finished.
   <FieldRef Name="DocIcon"></FieldRef>
   <FieldRef Name="LinkFilename"></FieldRef>
   <FieldRef Name="Resume_x0020_Name"></FieldRef>
   <FieldRef Name="Resume_x0020_Short_x0020_Description"></FieldRef>
   <FieldRef Name="Resume_x0020_Long__x0020_Description"></FieldRef>
   <FieldRef Name="Last_x0020_Modified"></FieldRef>
   <FieldRef Name="Editor"></FieldRef>
   <FieldRef Name="LinkCheckedOutTitle"></FieldRef>
Save the file and let's move onto the ONET.XML.  Browse back up to the SPSPERS\XML folder and open the ONET.XML file in your favorite text editor.  In there, look for the <ListTemplate> XML Element.  Now what we need to do is add an XML Element that describes our new document library.  You can use the <ListTemplate> for doclib as an example.  Our new XML Element should look like the following:
<ListTemplate Name="resumedoclib" DisplayName="Resume Document Library" Type="121" BaseType="1" OnQuickLaunch="TRUE" SecurityBits="11" Description="Resume Document Library" Image="/_layouts/images/itdl.gif" DocumentTemplate="101">
Now one last thing we need to do is create a list using this template.  Do a search for <Lists> and it should put you near the location where we define lists.  From here, we need to add an XML Element <List> for our new item.  Below is the example of how we do this:
<List Title="Employee Resumes" Type="121" Url="Resumes" QuickLaunchUrl="Resumes/Forms/AllItems.aspx" Description="Resumes are to be placed here.">
As you can see, it is not hard to do these things, but you must become familiar with the SharePoint XML which at times can be confusing.  It is also quite nerve racking when you are dealing with XML configuration files this big.  I hope that's a good start on where to go from here.
Posted on Tuesday, May 9, 2006 4:15 PM SharePoint | Back to top

Comments on this post: SharePoint - Creating a custom document library through ListTemplates

# re: SharePoint - Creating a custom document library through ListTemplates
Requesting Gravatar...
is this relevant anymore? there is no \60\TEMPLATE\
Left by periwinkle del torro on May 27, 2009 12:29 PM

Your comment:
 (will show your gravatar)

Copyright © Matthew Podwysocki | Powered by: