Visit our SharePoint Forum

SharePoint developer? Submit Yourself as Freelancer

Tuesday, July 8, 2008

Creating List Defination

Steps:
1. Copy an existing List defination folder (eg, CustList folder ) from Local_Drive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATES\FEATURES and Paste in the same Features folder with a diffrent name say, "JobandInterviewTracking" List.

2. Open Feature.xml in JobandInterviewTracking main folder and change the GUID,Title and scope of the feature if required.

3. Open up the elements.xml file(in List Templetes folder) that identifies the list template and specifies information to display on the Create Page. Give it a Type value that is above 10000 and different from any other custom list definitions used in your deployment, Change Name, display name,description .


4. Change the folder name,which contains schema.xml to "Name" element(i.e JobandInterviewTracking) specified in elements.xml.

5. Install the feature by using following commands:

a. stsadm -o installfeature -filename JobandInterviewTracking\Feature.xml
b. stsadm -o activatefeature -name JobandInterviewTracking -url
http://Server/Site/Subsite

To test the new Feature, navigate to the Create Page and create a list through the template.
Now, Lets Modify Schema.xml

Firstly, What you can do with schema.xml

The following kinds of tasks can be performed in a Schema.xml file to customize a list definition:

*Add custom fields built on the base field types defined in FldTypes.xml (You cannot create custom base field types.)

To do this we will have to modify schema.xml , and add our own custom column(that we will create) in default Item content type. This column will then be displayed along with the Title column when one craetes the List.
Steps:
1. Open schema.xml in VS or Notepad. Locate "ContentType ID="0x01" in ContentTypes tag.
2. Now Open ctypeswss.xml in ctypes folder in Features directory and copy the defination for "ContentType ID="0x01" and paste in schema.xml . see below:

3. Add the field into Fields tag and ViewFields tag in schema.xml as below:


To add custom column please read the article specified : here

*Create a custom view for lists created through the list definition.
This can be done with "Views" tag which contain defination for all default views in the list.
You can specify your custom view's name,Id,url of page,header,footer,fields in the view speciifed with CAML query tag, and orderby clause. You can also specify number of items to show in the view and how to display them,What to display when no items are returned in the view and so on...

*Specify custom form pages for working with list items.
This is done in "Forms" tag where you can specify Form with its type{ DispForm,EditForm,NewForm}, form's url, and WebPartzoneId ( usually main ).

*Specify the default description that is displayed for the list in the user interface (UI)
This is done with DefultDescription tag , but this description is overriden by description tag in the list defination specified in ONet.XML.

*Define the Actions area that is displayed in the side navigational area of list views

Diffrence between List templete and List Definations

2 comments:

Anonymous said...

Isha can you contact me
Neha

Anonymous said...

Thanks for sharing...

I have also consolidated more tutorials at SharePoint Tutorials

SharePoint Programming