Wednesday, August 20, 2008

Creating Custom List Definition in SharePoint Sites



  1. Copy the Custlist folder located in the Local_Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\TEMPLATE\1033\Site_Template_Name\LISTS directory.
    Rename the new folder as appropriate for the list.
    The following example creates a list to organize shared commuting for employees, and so the folder is named COMMUTING.
    Open the SCHEMA.XML file of the new list folder and create field definitions by adding Field elements within the empty Fields element in the opening MetaData element.
    Definitions added in the MetaData element specify the names and types of fields to use in the list. This example defines seven fields, including Text, Choice, Number, and Note fields. The Choice fields create drop-down lists for making selections.




    Eastgate
    North Park
    South Terrace Center
    Lake Shores




    7am
    8am
    9am
    10am




    4pm
    5pm
    6pm
    7pm





    All fields except the last Note field require that users provide information in order to sign up.
    After you define the fields, you must specify them as view fields in order for them to display in the list. To do this, search for the ViewFields element within the section of SCHEMA.XML that defines the All Items view and add field references, as follows:








    It is required that a custom list definition have a default description. Add a DefaultDescription element within the MetaData element of the SCHEMA.XML file, as follows:
    Use this list to organize shared rides to and from work with others.

    To display the list as an option on the Create Page, you must specify the new list type within the ListTemplates element of the ONET.XML file for the site definition, located at Local_Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\TEMPLATE\1033\[Site_Template_Name]\XML. To do this, find the ListTemplates element and add a ListTemplate element, as follows:


    The example specifies both the displayed and internal names, as well as an image and description to use on the Create Page. Since the list definition is based on a the Generic List type, the value of its BaseType attribute is set to 0.
    Important The Name attribute must be set to the exact name of the new list folder. To identify the list, assign a numerical ID that is not being used elsewhere and that is less than 1000 to the Type attribute.
    The example sets the OnQuickLaunch attribute to FALSE. This attribute specifies whether the option to display the list in the Quick Launch area appears selected by default on the page for creating an instance of the list.
    The SecurityBits attribute specifies permissions for a list, where the first bit represents Read access and the second bit represents Write access. The bit for Read access contains one of two possible values: 1 allows all users Read access to all items, and 2 allows users Read access only to items they create. The bit for Write access contains one of three possible values: 1 allows all users to modify all items, 2 allows users to modify only items they create, and 4 prevents users from modifying the list. This example sets the security bits to 12, which prevents users from modifying the items of other users.
    The new list list definition now appears on the Create Page and users can add lists to the Microsoft SharePoint site using the new definition.