NOTE: Content type is not easy to work with in an iterative development environment. As the content type is created and used at many different place, you can’t simply change the content type definition and re-deploy it.
Created new VS 2010 Empty Sharepoint Project, “AlbumListDefinition’, sandbox solution. Add a new item of List Definition, called AlbumList.
in the next screen:
Then rename the files as indicated:
Open the elements.xml under Driving Music, and edit:
<?xml
version=“1.0“
encoding=“utf-8“?>
<Elements
xmlns=“http://schemas.microsoft.com/sharepoint/“>
<ListInstance
Title=“Driving Music”
OnQuickLaunch=“TRUE”
TemplateType=“10000”
Url=“Driving Music”
Description=“Driving Music – Description“>
</ListInstance>
</Elements>
The actual structure is in the file called schema.xml
Open it and let’s edit it: (the first few lins only; between <ContentTypes>)
<ContentTypes>
<ContentType
ID=“0x0100CE2744E3BAEA4734B2333D043AA5DD2C008CE532561D94F24791EB8149A5763927”
Name=“Track-part2“
Group=“Music“
Version=“0“>
<Folder
TargetName=“Track“/>
<FieldRefs>
<FieldRef
ID=“{fa564e0f-0c70-4ab9-b863-0177e6ddd247}“
Name=“Title“
DisplayName=“Title“/>
<FieldRef
ID=“{52d63c75-2b4e-41f2-9091-c92279c27f75}“
Name=“ReleaseDate“/>
Required=“TRUE“
Hidden=“FALSE“
ReadOnly=“FALSE“/>
</FieldRefs>
</ContentType>
</ContentTypes>
In here, we’re creating another content type that’s inherited from the Track conten type. The name of the new content type is Track-part2.
***** If parent’s ID is AAA-AAA…., then any child inherited from the parent will have a ID of AAA-AAA…. Plus whatever it’s own ID.
The inherited content type simply attaches a GUID at the end of the parent content type with 00 as a separator. This is how SharePoint knows which content type is a parent of which. Namely: {Parent’s ID} + 00 + {Child’s Own ID} è Child’s Final ID
Also, in schema.xml, add som code in between <fields> (I guess any fields in the FieldRefs – other than Title – you have to add it here?)
<Fields>
<Field
ID=“{52d63c75-2b4e-41f2-9091-c92279c27f75}”
Type=“DateTime“
DisplayName=“ReleaseDate“
Required=“FALSE”
Format=“DateOnly“
Group=“Music”
StaticName=“ReleaseDate“
Name=“ReleaseDate”
/>
</Fields>
Optionally, in schemal.xml, add this to the <List> tag:
EnableContentTypes=“True”
This is the same as allow management of content types. Build and deploy!
You will see that a new list “Driving Music” has been created for you.
And when you create a new list, you will see the AlbumList definition available.