信息来源:
The SharePoint SDK shows How to - Create a Custom List Definition but is strange enough not complete. If you follow the SDK sample - the extra field you created in your custom list definition will NOT show up in the SharePoint form pages (Edit item, new item and view item).
In the next posting, I will describe in short the different steps - the last step is the one which I think is missing.
· Create a new feature as explained in the SharePoint SDK. Afterwards install and activate the feature.
· Modify the SCHEMA.XML file - Add your custom field inthe Fields section
<Fields>
<Field Type="Choice" Name="FavoriteColor" DisplayName= "Favorite Color"
ID="{5F11FE7B-C8D4-4849-A400-133352D17ECF}">
<CHOICES>
<CHOICE>Red</CHOICE>
<CHOICE>Green</CHOICE>
<CHOICE>Blue</CHOICE>
</CHOICES>
</Field>
</Fields>
· Add a reference to the Field you defined within the ViewFields section
<ViewFields>
<FieldRef Name="Attachments" ></FieldRef >
<FieldRef Name="LinkTitle" ></FieldRef>
< FieldRef Name="FavoriteColor"></ FieldRef>
</ViewFields>
· Modify the ContentTypes section and modify the Item contenttype to include the custom column. This change will make sure that the custom column will also show up in the edit and new forms.
<ContentTypes>
<ContentTypeRef ID="0x0120" />
<ContentType ID="0x0100EE310F92BD4F4ee79829A2FB3A01F1ED"
Name="Item" Group="List Content Types" Description
="Create a new list item." Version="2" FeatureId=
"{695b6570-a48b-4a8e-8ea5-26ea7fc1d162}">
<FieldRefs>
<FieldRef ID="{c042a256-787d-4a6f-8a8a-cf6ab767f12d}"
Name="ContentType" />
<FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}"
Name="Title" Required="TRUE" ShowInNewForm=
"TRUE" ShowInEditForm="TRUE" />
<FieldRef ID="{5F11FE7B-C8D4-4849-A400-133352D17ECF}"
Name="FavoriteColor"/>
</FieldRefs>
<XmlDocuments>
<XmlDocument NamespaceURI="
http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
<Display>ListForm</Display>
<Edit>ListForm</Edit>
<New>ListForm</New>
</FormTemplates>
</XmlDocument>
</XmlDocuments>
<Folder TargetName="Item" />
</ContentType>
</ContentTypes>
· Finally create a new list using the new custom SharePoint list definition