Monday, November 28, 2011

Creating a new template for custom lists


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 ListTemplatessection, 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. TheName 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.

No comments:

Post a Comment

Thank you for Commenting Will reply soon ......

Featured Posts

#Linux Commands Unveiled: #date, #uname, #hostname, #hostid, #arch, #nproc

 #Linux Commands Unveiled: #date, #uname, #hostname, #hostid, #arch, #nproc Linux is an open-source operating system that is loved by millio...