Exploring the 12 Hive : TEMPLATE Directory

We will take a look at the structure of the file system in SharePoint 2007 and how the files are used. As a developer you must know about the 12 HIVE folder.

If we look at a standard Microsoft Office SharePoint 2007 installation we can see that a new directory has been created under the following;
C:\Program Files\Microsoft Shared\Common Files\web server extensions
You will now see a 12 directory. This is known as the “12 HIVE” and is the directory that holds the necessary system files that drive SharePoint 2007.

The following directories can be found under the 12 hive;
For the purposes of SharePoint development you will, for the majority of the time, be working with the TEMPLATE directory.

The TEMPLATE DirectoryHere is the structure under the TEMPLATE directory;

1033 - ADMIN - CONTROLTEMPLATES - DocumentTemplates - FEATURES - GLOBAL - IMAGES - LAYOUTS - Pages - SiteTemplates - SQL - THEMES - XML

The TEMPLATE\1033 Directory : There are two directories that you need to know about here. The Workflow directory is where you will find the WSS.ACTIONS file. This file is used by SharePoint Designer 2007’s Workflow Designer. All of the workflows functions available to Designer are defined here. If you create workflow functionality using Visual Studio 2005/2008 and you want the functions to appear within the Workflow Designer, you will need to create a new .ACTIONS file.

The TEMPLATE\1033\STS Directory : The SharePoint Team Services or STS directory has one sub-directory within it. The DOCLIB directory contains several further sub-directories, each of which holds a template for a specific content type. There are templates for the Office applications, Word, Excel, PowerPoint and OneNote. There are also templates for the different types of page that can be created in SharePoint.

The TEMPLATE\1033\XML Directory : A more important directory within 1033 is the XML directory. Within this directory are several XML files.

Note : Changes to any of the file could be overwritten by SharePoint Service Packs.

DEADWEB.XML – This file is used during the site expiration process. Only change this file if you need to change the message that is displayed during the site expiration process.
RGNLSTNG.XML – This file holds the regional settings used by SharePoint 2007. You should not need to change this XML file.
WEBTEMP.XML – This file defines the pointers to the GLOBAL, STS, MPS, CENTRALADMIN, WIKI and BLOG site definitions. You can amend this file to either display or hide site templates during the New Site Creation process (newsbweb.aspx and scsignup.aspx).

WEBTEMPBDR.en-US.XML – This file defines the pointers to the BDR site definition. You can amend this file to either display or hide site templates during the New Site Creation process (newsbweb.aspx and scsignup.aspx).

WEBTEMPOFFILE.XML - This file defines the pointers to the OFFILE site definition. You can amend this file to either display or hide site templates during the New Site Creation process (newsbweb.aspx and scsignup.aspx).
WEBTEMPOSRV.XML - This file defines the pointers to the OSRV site definition. You can amend this file to either display or hide site templates during the New Site Creation process (newsbweb.aspx and scsignup.aspx).
WEBTEMPSPS.XML - This file defines the pointers to the SPS, SPSPERS, SPSMSITE, SPSTOC, SPSTOPICM, SPSNEWS, CMSPUBLISHING, BLANKINTERNET, SPSNHOME, SPSSITES, SPSCOMMU, SPSPORTAL, SRCHCEN, PROFILES, BLANKINTERNETCONTAINER and SPSMSITEHOST site definitions. You can amend this file to either display or hide site templates during the New Site Creation process (newsbweb.aspx and scsignup.aspx).
WEBTEMPSRCH.XML - This file defines the pointers to the SRCHCENTERLITE site definition. You can amend this file to either display or hide site templates during the New Site Creation process (newsbweb.aspx and scsignup.aspx).
It is preferable to clone and existing site definition and associated WEBTEMPxxx.XML file rather than edit an existing one. This will prevent your changes from being overwritten if a Service Pack is applied.
The final directory under 1033 is STS. This directory holds a subdirectory, DOCTEMP which contains further subdirectories that hold the definitions and templates for document types that are associated with document libraries. You will find templates for Microsoft Word, Excel and PowerPoint amongst others. You should not need to amend any of these files.

The TEMPLATE\ADMIN Directory : The files in the ADMIN directory are used by the Central Administration pages. There are three directories within ADMIN; 1033, Content Deployment and SSO. 1033\Policy\Report contains a reporting template and sample data. The Content Deployment directory contains the DeploymentUpload.aspx page. Finally, SSO contains all of the aspx pages for Single Service Sign-On. These files should not be amended.

The TEMPLATE\CONTROLTEMPLATES Directory : The CONTROLTEMPLATES directory is where the ASP.NET 2.0 control template files are held. Control templates are small re-usable files that contain components of a web page. An example is welcome.ascx. The welcome.ascx file defines the dropdown menu that appears under Welcome name on the top navigation section of a SharePoint 2007 page.
These pages are pulled into SharePoint 2007 aspx pages. You can create your own ascx pages.

The TEMPLATE\DocumentTemplates Directory : This directory contains one file, wkpstd.aspx, which is the base master file for Wiki pages.
Tips & Tricks : It is worth noting that although this page can be cloned and modified it will not be used by any Wiki page other than the first page that is created. This is because the wkpstd.aspx page is hard coded and is always used to create further Wiki pages.

The TEMPLATE\FEATURES Directory : The FEATURES directory holds subdirectories for each Feature that is available within SharePoint 2007. Each of these subdirectories will hold at least one file, feature.xml – this file will define the Feature and will have pointers to any other files required by the Feature.

The TEMPLATE\GLOBAL Directory : The GLOBAL directory holds two very important files; default.master and mwsdefault.master.
The default.master file is the master file that all files are based on. If you change this file, the change will be applied to every page that was created using an out-of-the-box site definition.

The mwsdefault.master file is the master file that all Meeting Workspace files are based on. If you change this file, the change will be applied to every Meeting Workspace page that was created using an out-of-the-box site definition.

The GLOBAL\XML directory holds the master ONET.XML file and master view XML files.
You should not need to modify any of the files within the Lists or XML directories at this time.

The TEMPLATE\IMAGES Directory : The IMAGES directory holds all images used within SharePoint 2007.

The TEMPLATE\LAYOUTS Directory : The LAYOUTS directory is another one of those directories that you should pay attention to. If you ever see /_layouts/ in the URL of one of your SharePoint sites, the aspx page will be in this directory. You will also notice the odd .ascx (control template), .js (JavaScript) and .master file within this directory. I am not sure why Microsoft didn’t tidy these files up and put them in more appropriate directories – as you become more familiar with SharePoint you will notice little inconsistencies like this.
In the LAYOUTS directory is application.master, the master file for all of the “admin” type pages, such as upload.aspx. When you begin to look at site customisation and branding you will see that application.master is one of the files that will need to be looked at.
The 1033\IMAGES directory : contains many of the images used in publishing sites, such as the thumbnails for each of the different pages types. There are also icons in this directory.
The 1033\STYLES directory : contains additional cascading style sheet (CSS) files.
The MOBILE directory : contains a series of aspx pages that are optimised for mobile devices.
The STYLES directory : contains one file, corefixup.css – more of an afterthought by Microsoft?

The TEMPLATE\Pages Directory : The Pages directory contains three aspx pages that are pulled in as subpages to other aspx pages.

The TEMPLATE\SiteTemplates Directory : A slightly misleading directory name as the SiteTemplates directory actually contains all of the SharePoint Site Definitions. It is in this directory that you would create any new site templates. There is a sub-directory for each site definition. Each sub-directory will contain at least an XML directory and a default.aspx file. The aspx file is the initial home page that is displayed when a site definition is used in SharePoint. The XML directory : will contain at least an ONET.XML file, which defines the setup of the site definition, such as which Features to load, where the web parts go and what they are, which document library templates to assign.
There will be extra files in some of the directories but they are used to provide the extra functionality that the site definitions require.
When creating new site definitions, you will place your directories here. Please have a look at our blog for creating custom site definitions in more detail.

The TEMPLATE\SQL Directory : The SQL directory contains a series of XML and SQL files. Some of these are used to define SharePoint configuration and content databases. You should not change these files.

The TEMPLATE\THEMES Directory : The THEMES directory contains 22 sub-directories, one for each theme that is available within SharePoint. Each sub-directory contains all of the files required for the theme, including all the images and the cascading style sheets.
You can create your own custom theme and place it within the THEMES directory. Please visit our blog Creating Custom Themes.

The TEMPLATE\XML Directory : The final directory, XML, contains XML and XSD files that are used in configuration of SharePoint. You shouldn’t need to venture in this directory, but if you do, be aware that any file you modify may be overwritten by SharePoint Service Packs.

alerttemplates.xml : Used to change the look and feel of Alert Notification emails for each list, web or custom types in your SharePoint Environment. You can set custom branding based on your to your email alerts.

BASE.XML : defines base types for lists that apply globally to all the SharePoint Web sites.

DOCICON.XML : This file is used for mapping file types to particular icons. To add the new icon to the file type follow below steps.
1). To add a .pdf (Adobe PDF) file name extension, add the following line to the ByExtension section in this file—

'<' Mapping Key="pdf" Value="pdf16.gif"/ '>'.
2). Add the file pdf16.gif (use Google Image Search to get this image) to the Program Files\Common Files\Microsoft Shared\web server extensions\12\Template\Images.

FLDTYPES.XML : Used to define how various SharePoint field types are rendered.

fldtypes_hold.xml : Used to define the hold status pertaining to entities realted to Records Management Policy. Note: This file is meant for internal use and it is recommended not alter the contents.

fldtypes_publishing.xml : Used to define the publishing field types like HTML, Links, Summary Links etc. In case of creating a new custom publishing field type, say Address (with validation) then a new entry related to this filed type has to be added to this file.All other xml files with prefix fldtypes are cutom built field types. Yet another notable field type is Business Data field. This field type is defined in fldtypes_spsbizdata.xml.

htmltransinfo.xml : Used to define the how to open various documents stored in the sharepoint server. The mapping entry for a particular document in this XML file will tell SharePoint server to open the document in a particular client application. If the document conversion mapping is not found in this file, SharePoint will prompt the user to download the document.

SharePoint is flexible enough for you to create custom properties by creating custom XML files in this directory.

This is a good start for you to go off exploring further in TEMPLATES Directory.