Bug with Duplicate Field Names in MOSS 2007
I encountered a rather nasty bug in Microsoft Office SharePoint Server (MOSS) 2007 yesterday that occurs when a custom field (i.e. site column) has the same name as an existing field. Note that this issue will also occur in Windows SharePoint Services (WSS) v3.
I initially created the following Fields.xml file:
<?xml version=“1.0“ encoding=“utf-8“ ?>
<Elements xmlns=“http://schemas.microsoft.com/sharepoint/“>
<Field ID=“{11F7E97D-6282-44b1-8222-2E6E377BCDFC}”
Name=“AnnouncementEndDate”
Type=“DateTime”
Format=“DateOnly”
Group=“Fabrikam Custom Columns”
DisplayName=“Announcement End Date“>
</Field>
<Field ID=“{9D1F7E52-EFBF-431e-9331-7DCA31D9CB7A}”
Name=“AnnouncementStartDate”
Type=“DateTime”
Format=“DateOnly”
Group=“Fabrikam Custom Columns”
DisplayName=“Announcement Start Date“>
</Field>
</Elements>
Next, I created the ContentTypes.xml file:
<?xml version=“1.0“ encoding=“utf-8“ ?>
<Elements xmlns=“http://schemas.microsoft.com/sharepoint/“>
<ContentType
ID=“0×010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF390064DEA0F50FC8C147B0B6EA0636C4A7D400EF37EB6F40C54a21A3872B1E6CA5BC0A”
Name=“Announcement Page”
Description=“Announcement Page is a custom content type …”
Group=“Fabrikam Content Types“>
<FieldRefs>
<FieldRef ID=“{9D1F7E52-EFBF-431e-9331-7DCA31D9CB7A}“ Name=“AnnouncementStartDate“ />
<FieldRef ID=“{11F7E97D-6282-44b1-8222-2E6E377BCDFC}“ Name=“AnnouncementEndDate“ />
</FieldRefs>
<DocumentTemplate TargetName=“/_layouts/CreatePage.aspx“ />
</ContentType>
</Elements>
Note
The really long ContentType ID above specifies that Announcement Page inherits from the out-of-the-box Welcome Page. I vaguely recall reading somebody’s blog where he or she stated that you shouldn’t inherit from the OOTB page types. However, I don’t recall the justification — if there even was one. I haven’t encountered any problems with this approach and thus haven’t seen any compelling reason to stop doing so.
Then I created a page layout for the new Announcement Page content type.
After building and deploying the corresponding WSP — and activating the feature — I verified that I could create a new Announcement Page and specify field values, including Announcement Start Date and Announcement End Date. Consequently I checked in my