Tuesday, August 11, 2009

Modify the Default Workspace Template in Project Server

In Project Server when we create a new project, by default a workspace is created which contain lists like issues, risks, shared document etc. Project server creates project workspace based on a WSS site template which is created at the time of installation. Project server allows us to customize this template, if the default installation does not meet our needs. The WSS site template that resides on the server is referred to as the site definition. There are two ways to customize Project Workspace template-

  1. Site Template - A site template is a .stp file. It is a package containing a set of differences and changes from a base site definition.

  2. Site definition - A site definition is a complete definition of a site. It is installed on file system (..\12\Template\SiteTemplates). A site definition consists of .aspx pages and .xml files with Collaborative Application Mark-up Language (CAML).

Create Project Workspace Template(.stp)
  • Create a sample project in Project server 2007. It will create a workspace for this project based on default workspace template.

  • Open the newly created project workspace site.

  • Make all the desired changes on site, e.g. create new list/document library, add web parts etc.

  • Navigate to Site Actions | Site Settings.

  • Select Save Site as Template from the Look and Feel section of the Site Settings page

  • Name the template. select the Include Content checkbox and select OK.

  • Navigate to the PWA Project Web Access Home Page

  • Select Site Actions -> Site Settings -> SiteTemplate Gallery.

  • Locate the template that was just saved, right-click it, and choose Save Target As to get the actual file.

  • Place the new .stp file in Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN.

  • From the command prompt change the directory to c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN and run following command

    stsadm -o addtemplate -filename "path\YourNewStpFileName.stp" -title "yoursitetitle"

  • Restart Internet Information Services (IIS).

  • After registering the template, go to the Server Settings on the PWA Site.

  • Select the Project Workspace Provisioning Settings link. Then change the Default Project Workspace Template setting to the new template and click Save.

  • All new projects will take on this template.

Create Project workspace site definition
The WSS site template that resides on the server is referred as the site definition.
The primary files that control the site definitions are located on the WSS Server in \\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\ and its subdirectories.The WSS sites’ HTML is produced on the fly based on the template.Use the following steps to create a new PWS site definition:

  • Create a copy of the default project workspace site by performing the following:
    • Locate the folder in the SiteTemplates directory(~12\ TEMPLATE\SiteTemplates) named PWS.
    • Make a copy of the PWS folder.
    • Rename the copy of the PWS folder and give it a meaningful name. e.g. MyPWS.

  • Create a new WebTemp*.xml file - A WebTemp.xml file contains the site definitions that are available to choose from when creating a project workspace.
    • Locate the file in the ~12\ TEMPLATE\1033\XML folder called webtemppwa.xml.
    • Make a copy of this webtemppwa.xml file.
    • Rename the copy to a meaningful name, prefixed with WebTemp. e.g. webtempMyPWS.xml.

  • Modify the new WebTemp*.xml file (webtempMyPWS.xml) to include the appropriate settings, specify a Template section followed by a Configuration section. E.g.

    <?xml version="1.0" encoding="utf-8"?>
    <Templates xmlns:ows="...">
    <Template Name="MyPWS" SetupPath="SiteTemplates\MyPWS" ID="6666">
    Title="My PWS"

    Attributes -
    Name — The exact name of the site definition folder you have created.
    SetupPath — The path to the site definition folder(SiteTemplate\)
    ID — ID of the template. The ID can be any number as long as
    no other site definition is using it. However, the ID must be between 6000 and
    7000 for it to be identified as a project workspace definition.

    Attributes in the Configuration section are -
    ID — If more than one configuration is specified, the ID is used in combination with the template name as a unique identifier.
    Title — The title of this configuration of the site definition. This value will appear as a choice in Site Provisioning Settings page.
    Description — The description of the site configuration.

  • Now you can modify the definition and add custom content, such as lists or web parts, to your newly created definition. E.g. add a new list - Follow these steps to create a custom list as a feature, and include it in your new site definition:
    • Create a feature for you list (in feature directory)e.g. MyCustomListFeature.

    • Install the feature, you must run the stsadm.exe command as follows:

      stsadm.exe -o installfeature -filename MyCustomListFeature\Feature.xml

    • Add this feature to the custom site definition you created earlier.Open the ONET.XML file in the TEMPLATE\SiteTemplates\MyPWS\XML
      folder. Look for the WebFeatures section toward the bottom of the ONET.XML file and add the FeatureId,

      <?xml version="1.0" encoding="utf-8"?>
      <Project ...>
      <ListTemplates ...>
      <DocumentTemplates ...>
      <Configuration ID="0" Name="Default>
      <Lists ...>
      <Modules ...>
      <SiteFeatures ...>
      <Feature ID="..." /> <!-- PWS Feature -->
      <Feature ID="*-*-*-*-*" /> <!-- your list Feature -->

  • Restart Internet Information Services (IIS) for the new definition to be seen by IIS.

  • Your new template should now appear in the Site Provisioning Settings page

No comments: