I've written a feature that deploys new columns along with a content type containing the columns. The feature is Site scoped and written in Visual Studio 2010 to deploy to SharePoint 2010.
When the feature is deployed the new columns and content type show up in the UI, however the content type is missing the new columns. I first suspected that the content type was being deployed first followed by the columns.
Update:
I followed Koen's blog post. His approach is to add the fields to the start of the content type's elements.xml
. The steps in his post worked perfectly! However when I tried to follow the same approach with the content type I'm working on, the site columns were deployed correctly but still not the content type!
I've done a lot of testing and may be confused now about what's actually happening. Here is the complete elements.xml
I'm using:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<!-- High Importance -->
<Field ID="{5FFCA09E-EF49-11DE-96C7-B58E56D89593}" Name="HighImportance"
Group="AA Site Columns" DisplayName="High Importance" Type="Boolean">
<Default>0</Default>
</Field>
<!-- Show On Home -->
<Field ID="{A8A659D4-42DC-409f-817F-A97DFC5694E6}" Name="ShowOnHome"
Group="AA Site Columns" DisplayName="Display on Home" Type="Boolean">
<Default>1</Default>
</Field>
<!-- Parent ContentType: Announcement (0x0104) -->
<ContentType ID="0x010400C01C3EAAEF4211DEA475A36356D89593"
Name="Intranet Announcement"
Group="AA Content Types"
Description="Test content type deployment."
Inherits="TRUE"
Version="0">
<FieldRefs>
<!-- Start Date -->
<FieldRef ID="{64cd368d-2f95-4bfc-a1f9-8d4324ecb007}" Required="TRUE" />
<!-- Expires -->
<FieldRef ID="{6a09e75b-8d17-4698-94a8-371eda1af1ac}" Required="TRUE" />
<!-- High Importance -->
<FieldRef ID="{5FFCA09E-EF49-11DE-96C7-B58E56D89593}" />
<!-- Show on home -->
<FieldRef ID="{A8A659D4-42DC-409f-817F-A97DFC5694E6}" />
</FieldRefs>
</ContentType>
</Elements>
Can anyone else deploy this correctly or see the problem here?