It was long desired! When we started this blog a couple of months back, we searched the web for a low cost SharePoint hosting provider, but none was affordable.
And recently I saw this, http://enroll.freesharepoint.com/uddi/freesharepoint/:
Though it has 5MB limit, but it
* supports SharePoint designer
* Multiple Users
* !! 5 MB is for ads only, it supports 50 MB actually (default quota) :-)
go ahead and start yours today ....
We are going to create a custom site definition by copying an existing site definition and then modifying the copy. In the modification stage we will change some CAML core schemas markup in two schema files: one that is a copy of a WebTemp.xml file, and the other a copy of an Onet.xml file.
Caution : You must not modify the originally installed WebTemp.xml file.
1). Copy an existing site definition folder located in the Local_Drive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates\ directory. For Example : Copy and paste the folder titled BLANKINTERNET, re-naming the copy to NEWBLANKINTERNET.
2).Open the ONET.xml file located in the “\NEWBLANKINTERNET\XML\” folder with Visual Studio. This document defines the Navigation Bars, Document Templates, Configurations, Lists, Features, and Modules of the site definitions. I have covered these in detail in my last article. Scroll down to the “Configurations” node and take a look at the given configurations. We’ll reference these later in this exercise.
3).Make a copy of the WebTemp.xml file that is located in Local_Drive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033\XML.
Give the file a unique name by appending a string to the name of the original file; for example, WebTempAction.xml.
4).Customize the contents of the new WebTemp file. Each WebTemp.xml file contains a collection of Template elements and Configuration subelements.
Description of Template Element
Template Element (Site) : Specifies a site definition that can be used to create Web sites within the deployment.
ID :Required Integer. Specifies the ID of the site definition. To avoid conflict with IDs that are natively used in Windows SharePoint Services, use IDs with values greater than 10,000.
Name : Required Text. Contains the name of the template.
SetupPath :Optional Text. Specifies the relative path in the setup directory that contains files used in the site definition, for example, SetupPath="global".
Important: In each Template element defined in the WebTemp file, the Name attribute must contain the same name that is assigned to the new folder. Also, to avoid conflict with IDs already used in Windows SharePoint Services, use unique values greater than 10,000 for the ID attribute.
Description of Configuration Element
Specifies the lists and modules used in creating a SharePoint Web site that is based on the site definition configuration represented by the Configuration element.
AllowGlobalFeatureAssociations : Optional Boolean. Specifies whether global Feature associations are allowed for sites that are created with the site definition configuration.
CustomMasterUrl : Optional Text. Specifies the URL for an alternate .master page that can be used on pages, in Web sites that are created through the site definition configuration, without unghosting those pages.
Note : Simply changing the value of the MasterPageFile attribute on pages that need an alternate master page, would unghost those pages.
Description :Optional Text. Contains the description of the site definition configuration that appears in the UI of Windows SharePoint Services.
DisplayCategory : Optional Text. Specifies the tab on which the site definition configuration will appear in the UI of Windows SharePoint Services, for example, Collaboration, Meetings, or some custom name.
Hidden :Optional Boolean. Specifies whether the site definition configuration appears as an option in the UI of Windows SharePoint Services.
ID : Required Integer. Specifies an ID for the site definition configuration that is unique within the site definition. A definition, such as STS or MPS, is defined by a Template element in a WebTemp*.xml file and by a corresponding Onet.xml file for the definition. See Parent Elements and Remarks below.
ImageUrl : Optional Text. Contains the URL for the preview image displayed in the UI of Windows SharePoint Services.
MasterUrl : Optional Text. Specifies the default master page to use for Web sites created through the site definition configuration.
Name : Optional Text. Contains the name of the site definition configuration.
RootWebOnly : Optional Boolean. TRUE to specify that the site created from the configuration exists only as the root Web site in a site collection. This attribute is not enforced in site templates (.stp files).
SubWebOnly : Optional Boolean. TRUE to specify that the site created from the configuration exists only as a subsite within a site collection. This attribute is not enforced in site templates(.stp files).
Title :Optional Text. Contains the title of the site definition configuration that is displayed on a tab in the UI of Windows SharePoint Services.
Type : Optional Text. Identifies the site definition, such as STS or MPS.
VisibilityFeatureDependency :Optional Text. Used in a WebTemp*.xml file to hide the site definition configuration based on the activation state of the specified Feature. When a configuration contains Features that depend upon another Feature, setting this attribute prevents the configuration from appearing as an option in the UI of Windows SharePoint Services if the specified Feature is not installed or activated. This attribute is not supported for Features with Web application scope.
You may need to reset Internet Information Services (IIS) to cause the new definition configuration to appear as an option in the UI. To do this, enter iisreset at a command prompt.
Site Definitions in SharePoint 2007
I am writing this article to give you a good overview for building custom site definitions. The terms site template and site definition are often used. Each of these allows the user to create a new site with a predefined set of Content Types, Layouts, and Lists etc. Site definitions are our preferred way to develop custom sites.
The focus of this article is on how site definitions and Portal definitions can be created and deployed. Site definitions are usually deployed as a part of a solution package, which is a compressed cabinet file made up of XML files and other resources. Solution packages are first added and then deployed to the MOSS farm. Once deployed the contents of the solution can be made available to sites, or used to create new sites.
CREATING A SITE DEFINITION
To create a site definition the first step is to create the “WebTemp” file. The purpose of the webtemp file is to describe to SharePoint the new Site Definition or Site Portal Definition. After the WebTemp file, the Site Definition file should be created, this is known as the ONET.XML file. Each Site Definition contains one or more configurations of lists and features. A site definition can also point to a Portal Definition. The portal definition uses one or more site definitions. The relationship of files is shown below:
All the webtemp files are XML files which live in the <12-hive>\TEMPLATES\1033\XML. The webtemp file can be thought of as Meta data or a description of a Site Definition. For example, the file contains the name of the site definition, as displayed in the Create Site page in a site or the Create Site Collection page in Central Administration.
Each Site Definition description is in a <Template> node that contains one or more configuration nodes. The name assigned to a Template must match the name of a directory in the <12-hive>\TEMPLATE\SiteTemplates directory. SharePoint then looks for the ONET.XML file in a subdirectory called XML to find the actual Site Definition. The ID of the Template must be unique across the SharePoint installation. The following is a sample template definition:
The Configuration declaration can define if the site definition can be used for a site root collection only, a sub web site only or both. This provides a level control on how the site definition can be used, and provides a mechanism to control how certain features are enabled.
In the case of a Portal definition, the webtemp template configuration adds some additional attributes:The attributes of interest are the ProvisionAssembly, ProvisionClass and ProvisionData. When creating a Portal site the class specified by the ProvisionClass attribute is called in the assembly specified by the ProvisionAssembly. The class is passed the value of the ProvisionData attribute as a parameter. Microsoft provides an implementation of a Provisioning Class. The Microsoft Provisioning Class (MPC) is used to create a Portal Site.
The MPC expects the ProvisionData value to be the path to an XML file, which contains instructions on the sites to create as part of the Portal Definition. This methodology is used to create the Publishing Site, which creates several sub sites. By looking in the PortalWebManifest.xml file specified above, it can be seen that four sites are created, News, Site Directory, Search Center, and Document center. Below is a sample Test Portal Provisioning Data XML file.
This file declares the top-level site that is to be created, and it uses the FTBLANKINTERNET #0 site definition. This is a reference back into the webtemp files; it is referencing a site definition template called “FTBLANKINTERNET” and from that definition use configuration “0”, the display name and description of the root level site are overwritten by the values entered by the user when the site is created.
The onet.xml file contains the actual site definition and is broken in to several sections, navigational areas, list templates, document templates, configurations, modules, components, and server e-mail footer. The MSDN documentation provides an good reference on the structure and contents of an onet.xml file (see http://msdn2.microsoft.com/en-us/library/ms474369.aspx). The best way to create a new onet.xml file is to copy one from the site templates directory which is close to what you need and then modify it to suit your needs. Below is an overview of the sections within the onet.xml file.
In the quick launch bar (left navigation in MOSS 2007), there sections under which lists and other links are displayed, for example:Each of the sections – Pictures, Documents etc is defined within the Navigational areas piece of the onet.xml file; this is done within the “Navbars” tag. These declarations have embedded HTML and have special functionality based on the value of the Name attribute and are not covered in detail here.
The Email footer section contains the text that is to be displayed at the bottom of e-mails generated from the site.
The document template section describes documents that can be created on the “New Page”. Each document Template defines a name, description, and a template file to be used. In most cases this section can be left unchanged.
The List Templates section allows for the creation of new List Types, which can be used as part of the site. The supporting files for the list template should be stored in a subdirectory called Lists below the Site definition directory. Another method of deploying a new List Type as part of a site definition is to deploy it as a feature. The Site definition can then activate the feature and use the List Type. This has the benefit of allowing the list type to be used independently of the site definition. For more information about the List Template section, see http://msdn2.microsoft.com/en-us/library/ms439434.aspx.
The Modules section specifies a collection of files or modules, which can be deployed when a site is created. A module could be a Web Part, or a file, which is to be added to a document library etc. When adding a file to a library, it is possible to specify the value of the properties the item should have. This even allows you to add web parts to a layout page when the site is created.
For more information on the Modules section, see http://msdn2.microsoft.com/en-us/library/ms467997.aspx
The components section allows you to define new “FileDialogPostProcessors” and “ExternalSecurityProviders”. These are low level processing objects within the SharePoint System; in most situations, no changes are required.
The configuration section is where the bulk of the site setup is defined. A site definition can contain one or more configurations; each configuration is uniquely identified and named within the site definition. The Configuration is broken down into several subsections, Lists, Site Features, Web Features, and Modules.
The Lists section defines Lists, which should be created as part of the site provisioning.
The Feature Id is the GUID of the feature that created the base list type for this list. The type identifies the list type from the specified GUID. The Title is the display name for the list. The URL is the partial URL for the root of this list. Finally the QuickLaunchUrl is the URL to be used for the link in the quick launch bar.
To find the GUID and the type for a specific list type, the easiest way to do this is to navigate to the Site Actions->Create page. This will present a page of list types, which can be created in the site. Select the list type you wish to use, and use the right mouse button to get the properties of the link. The link will contain the feature id and list template or type id. For example:
Note that some list types are only available after certain features have been activated.
The site features section is used to control which features are enabled when the site definition is used to create a site, which is a root site collection. Some features can only be enabled at a collection level.
There is a large number of feature ids, to understand and identify. There are two methods to identify the feature id's required for a site definition. The first method is to review site definitions that have the features enabled and look at the either the site or web features nodes within the configuration nodes. This is usually required when the site definition being constructed combines the features of two existing site definitions. The second method is to find the feature id's from the features activation page.
To find the feature id's navigate to the
Site Actions->Site Settings->Site Collection Features
Site Actions->Site Settings->Site Features.
From this page, use the right mouse button to view the source of the HTML page. Search for the name of the feature you wish to have activated in your site definition. For example searching for “Office SharePoint Server Enterprise Site features.
Looking at the DIV tag it has an id, which is a GUID. This GUID is the feature id for the feature. This can then be added to the SiteFeatures node.
The web features section behaves the same as the site features section, except that the features are activated when the site definition is used to create a child site. Note that some features can and should only be activated on a Site Collection root site.
The modules collection defines the set of modules that are to be deployed as part of the site provisioning. This is not to be confused with the Modules section for the template described above. This is the set of modules defined in the Modules section which are to be installed for the current configuration.
Hopefully this article has given you a jump start on building your own site definitions.