Friday, April 18, 2008

Site Definitions - Part 1

Site Definitions

  • In a very real sense, site definitions are the heart of Sharepoint. A site definition defines a unique type of Sharepoint site.
  • Site Definitions are not Features. They are very similar to Features, schema has a lot of overlap, they're deployed using solution packages just like Features are. But they are not activated the same way and there is no feature.xml for the site definition itself.
  • Core WSS Definitions
    • GLOBAL - A template which is applied before any of the others are applied always. It contains all the common elements for all sites. The core content types, all the fields, and a couple of features as well.
    • STS - Team Site. Team site comes in a couple of flavors, team site itself, blog and blank site template.
    • MPS - Meeting workspaces
    • CENTRALADMIN - Central Admin
    • WIKI - Wiki
    • BLOG - Blog


Site Definitions Files

  • Just like everything else that makes up a Sharepoint site, site definitions are stored in the 12 Hive. In the case of US English being 1033, the files of interest are stored as follows:
    • TEMPLATE\1033\XML
      • WEBTEMP.xml (The rule here is that as long as the xml files in this folder begins with the 'webtemp', then Sharepoint is gonna see that as a web template)
    • TEMPLATE\SiteDefinitions\[site]\XML
      • ONET.xml (stands for Office.NET)

Global Site Definition

  • The Global Site Definition
    • Located at 12\TEMPLATE\Global
    • It is always gonna be created for every single Sharepoint site.
    • It is responsible for laying down the default master pages that are used by team sites.
    • It also creates Galleries. And Galleries are created for:
      • List Templates
      • Site Templates
      • Web Parts
      • Master Pages
      • People and Groups
    • So you can always be assured that on every site that the galleries which contains the above lists will always be present.
  • 12\TEMPLATE\Global folder contains the following files:
    • Lists folder
    • XML folder
      • ONET.XML (This is the definition itself of the global site template)
    • default.master (used in the team sites, if you want to customize a site you can grab the default.master from this folder instead of copy it from the Sharepoint designer)
    • mwsdefault.master (meeting workspace default master file)


ONET.XML

  • Open ONET.XML in the 12\TEMPLATE\Global\XML folder.
  • The first section in ONET.XML is the ListTemplats section.
    • There is a ListTemplate created for each of the following lists:
      • MasterPageGallery
      • sitetemplategalleryList
      • listtemplategalleryList
      • webpartgalleryList
      • userinfo_schema_listtitle
    • ListTemplats is only allowable only in the global site definition. If you want to use ListTemplates in your own site definitions, use Feature.
  • The second section is BaseTypes
    • Content Types
      • Generic List = 0
      • Document Library = 1
      • Disscussion Forum = 3
      • Vote or Survey = 4
      • Issues List = 5
  • The third section is a couples of Features under the Configurations => SiteFeatures node
    • The first one is fields Feature
    • If you open 12\TEMPLATE\FEATURES\fields folder, it contains:
      • feature.xml
      • fieldswss.xml (this is the elements xml), in this file you can see all of the site columns that are defined by default in every single global site, and this is a handy one to use for reference whenever you creating your own content types that are gonna contain fields that are built in to the global site definition, because you will need the field IDs in this xml.
    • The second one is the content type Feature
  • The fourth section is Lists which contains the following lists:
    • MasterPageGallery (Type = 116)
    • sitetemplategalleryList (Type = 111)
    • listtemplategalleryList (Type = 114)
    • webpartgalleryList (Type = 113)
    • userinfo_schema_listtitle (Type = 112)
  • The last section is Modules which defines that it will place default.master File into the master page gallery.
blog comments powered by Disqus