Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Exploit SharePoint List Definitions to Maximize Your Brand : Page 2

You can customize site definitions and add functionality to list editing tools, but if your branding and tools strategies aren't implemented in your list definitions, then your site isn't completely following those strategies. Find out how list definitions work, what their relationship is to site definitions, and how to change the appearance and the structure of the list.


advertisement
How Do List Definitions Work?
List definitions are actually a part of site definitions. If you look under the standard STS site definition in SharePoint (C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\TEMPLATE\1033\STS), you'll find a LISTS directory. This directory contains a set of list definitions. These list definitions are referenced from the XML\ONET.XML file in the site definition. Under the <Project?> node in the ONET.XML file is a <ListTemplates> node that contains a set of <ListTemplates> nodes, each of which correspond with the directories in the LISTS directory.

Connecting a list definition to a site definition is the process of creating the list definition, copying it to the LISTS directory, adding the appropriate <ListTemplate> node in the XML\ONET.XML file, performing an IISRESET, and finally creating a new site.

In order to walk through the examples in this article, it's advised that you create a new site definition to work with. The article "SharePoint Site Definitions: Why You Need Them and How to Use Them" shows you how to do this. Once you've done that, it's further advised that you create a new list definition based on one of the list definitions that already exist in the site definition. To create that new list definition, follow these steps:

  1. Copy one of the directories under the site defintion's LISTS directory to a new name. For example, copy CONTACTS to TESTCONT.
  2. Open the ONET.XML in the .\XML directory of the site definition.
  3. Locate the <ListTemplates> node.
  4. Copy the <ListTemplate> node underneath the <ListTemplates> node that corresponds to the list you copied. The Name attribute directly maps to the directory name that you copied (if you copied CONTACTS, it's the ninth node in the list).
  5. Paste a copy of this node at the end of the <ListTemplate> nodes.
  6. Change the Name attribute to match your new directory name. In the case of this example, TESTCONT.
  7. Change the DisplayName attribute to something descriptive. In this example, that might be "Test Contacts."
  8. Change the Type attribute to a unique number. In this case, 201 should work. The 200 series of numbers is unused so it's a good place to start with numbering your custom list definitions.
  9. Save the ONET.XML file.
  10. Reset IIS (Start—>Run—>IISRESET)
  11. Create a new site and verify that you can create a new list of type "Test Contacts."
Now that you've created new copies of a site definition and a list so that your changes won't break anything, it's time to dig into the heart of the list definition. Internally, a list definition consists of a SCHEMA.XML file and a set of .aspx pages that represent the display, new, update/edit, and default views for the list. These files are referred to in the SCHEMA.XML so that, when the list is created, SharePoint creates links to these pages in the database.



The SCHEMA.XML has the basic format shown in Figure 1.

Figure 1. The SCHEMA.XML File: This shows the SCHEMA.XML file's basic structure.

SCHEMA.XML has two basic sections. The first section is the <MetaData> section. This is the definition for the list and the most commonly modified. The second section is the Data section. This allows you to automatically add data to the list when the list is created. This is useful for lists such as a project risks list that might have a set of risks that are common to every project. For instance, the risk of organizational changes and personal changes are common to every project. You might add these to the list by including the data in the SCHEMA.XML file.

In the <MetaData> section of the file, there are sections for the fields, the views, and the forms used by the list. This is where the heart lay of customizations for a list. In the following sections, you'll look at how to manage the appearance of the pages and to add a new field to the list.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap