Export (0) Print
Expand All

Example 8 — Creating a new template for custom lists

SharePoint Team Services 1.1

To create a new template for custom lists, do the following:

  1. Go to the Program Files\Common Files\Microsoft Shared\web server extensions\50\Templates\1033\Layouts directory and copy the CustList folder, renaming the new folder appropriately.
  2. In this new directory, open the file SCHEMA.XML.
  3. Add as many field definitions as needed to SCHEMA.XML in the empty Fields element just after the opening <MetaData> tag. The following example defines fields for a sign-up sheet that has drop-down lists:
    <Fields>
      <Field Name="LinkTitle" DisplayName="Driver" Required="TRUE"/>
      <Field Name="Title" DisplayName="Driver" Required="TRUE"/>
      <Field Name="ParkingLocation" Type="Choice" DisplayName="Park & Ride Location" Required="TRUE">
        <CHOICES>
          <CHOICE>Eastgate Mall</CHOICE>
          <CHOICE>North Park</CHOICE>
          <CHOICE>South Terrace Center</CHOICE>
          <CHOICE>Lake Shores Park & Ride</CHOICE>
        </CHOICES>
      </Field>
      <Field Name="ToWork" Type="Choice" DisplayName="To Work" Required="TRUE">
        <CHOICES>
          <CHOICE>7am</CHOICE>
          <CHOICE>8am</CHOICE>
          <CHOICE>9am</CHOICE>
          <CHOICE>10am</CHOICE>
        </CHOICES>
      </Field>
      <Field Name="FromWork" Type="Choice" DisplayName="From Work" Required="TRUE">
        <CHOICES>
          <CHOICE>4pm</CHOICE>
          <CHOICE>5pm</CHOICE>
          <CHOICE>6pm</CHOICE>
          <CHOICE>7pm</CHOICE>
        </CHOICES>
      </Field>
      <Field Name="Capacity" Type="Number" DisplayName="Capacity" Required="TRUE"/>
      <Field Name="Preferences" Type="Note" DisplayName="Personal Preferences"/>
    </Fields>
  4. Search for the ViewFields element within the AllItems section of SCHEMA.XML and add field references, as follows:
    <ViewFields>
      <FieldRef Name="LinkTitle"></FieldRef>
      <FieldRef Name="ParkingLocation"></FieldRef>
      <FieldRef Name="ToWork"></FieldRef>
      <FieldRef Name="FromWork"></FieldRef>
      <FieldRef Name="Capacity"></FieldRef>
      <FieldRef Name="Preferences"></FieldRef>
    </ViewFields>
  5. Go to the Program Files\Common Files\Microsoft Shared\web server extensions\50\Templates\1033\xml directory and open ONET.XML.
  6. To make the new list template available on the Create page for the SharePoint team Web site, add a definition for a list template to the ListTemplates section, as follows:
    <ListTemplate Name="Commuting" DisplayName="Shared Rides" Type="133" BaseType="0" Default="FALSE" OnQuickLaunch="FALSE" SecurityBits="111" 
        Description="Save gas and enjoy the ride to work with co-workers." Image="_layouts/images/ittask.gif"></ListTemplate>

    Note   The value of the Type attribute must be a number that is not being used elsewhere in the ListTemplates section and that is less than 1000. The Name attribute must be set to the exact name of the new custom list folder.

  7. The new template now appears on the Create page and custom lists can be added to the team Web site.

See Also

Introduction — What Is CAML?

Location of CAML


Show:
© 2014 Microsoft