Site Columns, Content Types, and Curly Braces
This actually came up a while back during a training course on MOSS customization and branding but I was reminded of it while doing the mind-numbing work of manually creating site column and content type features for a client. When you assign a GUID to a Feature it is up to you whether or not you want to include the curly braces ("{" and "}") at the beginning and end of the string. SharePoint doesn’t really care. But lest you become a lazy developer and think you can do away with those darned curly braces forever, SharePoint has a nasty little surprise waiting for you when you get to creating custom site columns and content types.
A typical Site Column manifest file looks something like this:
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Field DisplayName="My Choices" ID="{9389f0d4-b136-40a5-ba34-f5603fef0803}" Type="Choice" Required="FALSE" Format="Dropdown" FillInChoice="FALSE" Group="Custom Columns" SourceID="{2e3e9929-9f6c-41c6-a002-d414fb0dcebe}" StaticName="My_x0020_Choices" Name="My_x0020_Choices">
<Default>Go back to sleep</Default>
<CHOICES>
<CHOICE>Get up and go to work</CHOICE>
<CHOICE>Go back to sleep</CHOICE>
</CHOICES>
</Field>
</Elements>
While the manifest file to create a content type that uses the above site column might look something like this:
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ContentType Name="My New Content Type" ID="0x0100651CE3D6FACE2C4ABEAFF2031F881794" Description="" Group="Custom Content Types" Version="0" >
<FieldRefs>
<FieldRef Name="My Choices" ID="{9389f0d4-b136-40a5-ba34-f5603fef0803}" Required="TRUE" />
</FieldRefs>
</ContentType>
</Elements>
Notice that the ‘ID’ property of each reference to the site column GUID starts and ends with curly braces. Although nothing ever tells you that this is so, those braces are REQUIRED. Remove them, and your feature will fail.
Details, details, details. Now back to my exercise in advanced carpal tunnel syndrome…
SourceID=”{2e3e9929-9f6c-41c6-a002-d414fb0dcebe}”
what value this represents to .