My adventures including my career (Web development and SharePoint), and my other interests (my family, arduino, Iot) and….

Month: August 2010

I am brand new to the Visual Studio 2010 templates for SharePoint, having relied on the WSPBuilder toolkit in the past for all my previous SharePoint work. I created what I thought would be a simple ContentType definition inheriting from Item (0x01) using Visual Studio and this is what I got:

1:<?xmlversion="1.0"encoding="utf-8"?>

2:<Elementsxmlns="http://schemas.microsoft.com/sharepoint/">

3:<!-- Parent ContentType: Item (0x01) -->

4:<ContentTypeID="0x01005ac69ad99b164765a7fcb7610c5bfa92"

5:Name="SolutionPackage - ContentType1"

6:Group="Custom Content Types"

7:Description="My Content Type"

8:Inherits="TRUE"

9:Version="0">

10:<FieldRefs>

11:</FieldRefs>

12:</ContentType>

13:</Elements>

I added two new fields to the FieldRefs element as well as one RemoveFieldRef to remove the title column as it did not really fit my scenario. I published to my SharePoint 2010 development environment and was bothered that my Title column was not removed. Here was what I published that did not immediately work:

What stand out now, is the Inherits="TRUE" section that is new to SharePoint 2010 foundation. If you look at the previous version on the ContentType definition for Windows SharePoint Services 3, you will that Inherits is not there:

InheritsOptional Boolean. The value of this attribute determines whether the content type inherits fields from its parent content type when it is created.

If Inherits is TRUE, the child content type inherits all fields that are in the parent, including fields that users have added.

If Inherits is FALSE or absent and the parent content type is a built-in type, the child content type inherits only the fields that were in the parent content type when SharePoint Foundation was installed. The child content type does not have any fields that users have added to the parent content type.

If Inherits is FALSE or absent and the parent content type was provisioned by a sandboxed solution, the child does not inherit any fields from the parent.

So, to remove the Title field using the RemoveFieldRef element, you must also remove the Inherits attribute entirely (or set Inherits=”False”) in the content type definition: