Creating a Custom SharePoint 2007 List Definition
Creating a custom site column for the submission comments
1. Create a folder named SubmissionColumns in the C:"Program Files"Common Files"Microsoft Shared"web server extensions"12"TEMPLATE"FEATURES (FEATURES) directory.
2. Create an xml file named feature.xml inside this folder that contains the following information:
<?xmlversion="1.0"encoding="utf-8" ?>
<Feature
Id="{a94f84a5-c87a-4fef-8e01-f064bc1bd9d7}"
Title="Submission Columns"
Description="This feature contains site columns used in the submission process"
Version="12.0.0.0"
Scope="Site"
xmlns="http://schemas.microsoft.com/sharepoint/">
<ElementManifests>
<ElementManifestLocation="submissioncolumn.xml" />
</ElementManifests>
</Feature >3. Create a xml file named submissioncolumn.xml that contains the following information:
<Elementsxmlns="http://schemas.microsoft.com/sharepoint/">
<FieldID="{374e02cc-fe2e-4247-8762-e69242f9ff94}"
Name="SubmissionComments"
SourceID="http://schemas.microsoft.com/sharepoint/v3"
StaticName="SubmissionComments"
Group="Submission Columns"
Type="Note"
DisplayName="Comments"
Sortable="FALSE"
Description="Comments on the submission"
Sealed="TRUE"
UnlimitedLengthInDocumentLibrary="TRUE"
AllowDeletion="TRUE"
ShowInFileDlg="FALSE">
</Field>
</Elements>
Here we are defining the system name (Name and StaticName) the base type (Type) and several other attributes of our site column. The FEATURES"fields folder contains examples of default site columns, and is useful in understanding how all these attributes are used.
4. Activate the feature using the following commands (in a command window, from the C:"Program Files"Common Files"Microsoft Shared"web server extensions"12"BIN directory):
stsadm -o installfeature -filename SubmissionColumns"feature.xml -force
stsadm -o activatefeature -filename SubmissionColumns"feature.xml -url http://localhost
Creating a custom submission list definition
1. Create a folder named SubmissionsList in the FEATURES directory.
2. Create a xml file named feature.xml that contains the following information:
<?xmlversion="1.0"encoding="utf-8" ?>
<Feature
Id="{6d2c42db-782c-417e-9c7c-2c941ef52b92}"
Title="Submission List"
Description="This feature contains a submission list definition"
Version="12.0.0.0"
Scope="Site"
xmlns="http://schemas.microsoft.com/sharepoint/">
<ElementManifests>
<ElementManifest Location="ListTemplate"Submissions.xml" />
</ElementManifests>
</Feature>
3. Create a folder named ListTemplate inside the SubmissionsList folder and add an xml file named Submissions.xml that contains the following information:
<?xmlversion="1.0"encoding="utf-8"?>
<Elementsxmlns="http://schemas.microsoft.com/sharepoint/">
<ListTemplate
Name="Submissions"
Type="6500"
BaseType="0"
OnQuickLaunch="TRUE"
SecurityBits="11"
Sequence="360"
DisplayName="Submissions"
Description="Create a submissions list when you want to allow users to submit submissions on a document"
Image="/_layouts/images/itgen.gif" />
</Elements>
Here we are defining a unique type number for our list (which can be used if we want to include this list in a custom site definition), the sequence it should appear in the ‘create’ page and other basic attributes. Note the displayname used must match the folder that contains the list schema defined in the next step.
4. Create a folder named Submissions inside the SubmissionsList folder and copy the FEATURES"CustomList"CustList"Schema.xml file into the Submissions folder.
5. Update the ContentTypes element in the Schema.xml file to the following:
<ContentTypes>
<ContentTypeRefID="0x01AB">
<FolderTargetName="Submission" />
</ContentTypeRef>
<ContentTypeRefID="0x0120" />
</ContentTypes>
Here we define our custom ‘submission’ content type as the base type for this list. The columns defined in this content type are then shown on the ‘add new item’ page.
6. Update the Fields element in the Schema.xml file to the following:
<Fields>
<Field
Name="Title"
ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}"
DisplayName="Title"
Sealed="TRUE"
SourceID="http://schemas.microsoft.com/sharepoint/v3"
StaticName="Title">
</Field>
<Field
ID="{475c2610-c157-4b91-9e2d-6855031b3538}"
Name="FullName"
DisplayName="$Resources:core,Full_Name;"
Type="Text"
SourceID="http://schemas.microsoft.com/sharepoint/v3"
StaticName="FullName">
</Field>
<Field
ID="{fce16b4c-fe53-4793-aaab-b4892e736d15}"
Name="Email"
DisplayName="$Resources:core,E-mail_Address;"
Type="Text"
SourceID="http://schemas.microsoft.com/sharepoint/v3"
StaticName="Email">
</Field>
<FieldID="{374e02cc-fe2e-4247-8762-e69242f9ff94}"
Name="SubmissionComments"
SourceID="http://schemas.microsoft.com/sharepoint/v3"
StaticName="SubmissionComments"
Group="Submission Columns"
Type="Note"
DisplayName="Comments"
Sortable="FALSE"
Description="Comments on the submission"
Sealed="TRUE"
UnlimitedLengthInDocumentLibrary="TRUE"
AllowDeletion="TRUE"
ShowInFileDlg="FALSE">
</Field>
</Fields>
Here we define the custom fields from our content type that we want to use in our list.
7. Lastly update the ViewFields element to contain the columns we want to display on our default list view:
<ViewFields>
<FieldRefName="Attachments">
</FieldRef>
<FieldRefName="LinkTitle">
</FieldRef>
<FieldRefName="FullName">
</FieldRef>
<FieldRefName="Email">
</FieldRef>
<FieldRefName="SubmissionComments">
</FieldRef>
</ViewFields>
8. Activate the feature using the following commands:
stsadm -o installfeature -filename SubmissionList"feature.xml -force
stsadm -o activatefeature -filename SubmissionList"feature.xml -url http://localhost
iisreset