Understanding Custom List Definitions in SharePoint.

For creating Custom List Definitions through Feature as a Provisioning Component, we need to create our Feature.xml file that would be pointing to element.xml having our List Definition.

The feature file would be something like this

<?xml version=1.0 encoding=utf-8?>

<Feature Id=00BFEA71-DE22-43B2-A848-C05509900111

    Title=My Custom List Feature

    Description=This is a custom list feature

    Version=1.0.0.0

    Scope=Web

    Hidden=TRUE

    DefaultResourceFile=core

    xmlns=http://schemas.microsoft.com/sharepoint/>

                <ElementManifests>

                                <ElementManifest Location=elements.xml />

                </ElementManifests>

</Feature>

The elements.xml would contain the following information

<?xml version=1.0 encoding=utf-8?>

<Elements xmlns=http://schemas.microsoft.com/sharepoint/>

    <ListTemplate

        Name=CustomList

        Type=10001

        BaseType=0       

        Sequence=2000

        DisplayName=My Custom List

        Description=Creating a custom list/>

</Elements>

 

Element manifest contains ListTemplate element.

Name – Name of the List. One important thing about Name attribute is that there must be a directory with the same name as value of this attribute within the feature directory which would contain schema.xml. All the information for the list would be defined in the schema.xml.

Type – List Type Identifier, for custom list types the value should be more that 10000.

BastType– Value 0 indicates that this list type is for standard list. ( 1- Document library, 3-discussion forums, 5- issue lists)

Sequence– It defines where the link would appear for the list type on the Create Page.

So we would have a folder for feature say My Custom List, this folder feature would have feature.xml,elements.xml and one more folder with name CustomList ( same as Name attribute value at elements.xml) . The CustomList folder contains schema.xml.

Schema.xml would be defining the content types, fields within the content types, views and forms for the list.

This is the basic structure of Schema.xml

<?xml version=1.0 encoding=utf-8?>

<List Title=My Custom List Url=Lists/CustomList BaseType=0>

                <MetaData>

                                <ContentTypes></ContentTypes>

                                <Fields></Fields>

                                <Views></Views>

<Forms></Forms>

                </MetaData>

</List>

In content types, we could add reference to standard as well as custom content types.

Fields- Here we need to include all fields for our referenced content type.

Views- Defining different views for the list.

Forms – We could associate our custom New, Edit or Display form. If not specified than default forms would be used.

Bye…


Author: Nishant Rana

I love working in and sharing everything about Microsoft.NET technology !

2 thoughts on “Understanding Custom List Definitions in SharePoint.”

  1. hi, i have a question, do we need to attach a database while creating a custom list. is it necessary.

    or sharepoint use lists as table so that we can store data in it.

    Like

Share your thoughts

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s