SharePoint 2010: RemoveFieldRef and Inherits = "TRUE"

I created a custom content type that inherits from the OOTB SharePoint Image Content Type. The only settings I made was to add a simple URL field and remove the two fields in the base type. See below:

<Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <!-- Parent ContentType: Picture (0x010102) --> <ContentType ID="0x0101020027f16ab27e6e45a6848c25c47aaa7053" Name="Custom Picture" Description="" Group="Custom" Inherits="TRUE" Version="0"> <FieldRefs> <RemoveFieldRef ID="{b66e9b50-a28e-469b-b1a0-af0e45486874}" Name="Keywords" /> <RemoveFieldRef ID="{a5d2f824-bc53-422e-87fd-765939d863a5}" Name="ImageCreateDate" /> <FieldRef ID="{c29e077d-f466-4d8e-8bbe-72b66c5f205c}" Name="URL" DisplayName="URL" Required="FALSE" /> </FieldRefs> </ContentType> </Elements> 

If I create an image library based on my custom content type, the “URL” field that I added appears in new / editable forms, however, two fields that I tried to delete also appear, i.e. RemoveFieldRef are ignored . If I look at the content type in "Site Settings → Content Type Gallery", these two fields are still listed there.

Setting Inherits = "FALSE" in my custom content type ( see MSDN definition ) successfully removes just these two fields on the "Site Settings → Content Type Gallery" page, but then none of the base fields are displayed in new / editable forms - only my custom URL -address ".

What can I do to ensure that all fields from the basic type of content "Image" are displayed in new / editable forms of my image library, except for two fields that I specifically deleted?

+7
source share
1 answer

I believe the nature of this problem is to understand how content type inheritance works.

From MSDN (http://msdn.microsoft.com/en-us/library/aa544268.aspx)

If Inherits is set to TRUE, the content type of the child object inherits all the fields that are in the parent,> including fields added by users.

If Inherits is FALSE or missing, and the parent content type is inline, the child> content type inherits only the fields that were in the parent content type when> SharePoint Foundation was installed. The type of child content does not have fields that> users have added to the type of parent content.

If Inherits is FALSE or missing, and the parent content type was provided by the sandboxed solution>, the child does not inherit any fields from the parent.

I think the key phrase is above: "If Inherits is TRUE, the type of child content inherits ALL fields that are in the parent, including fields added by users."

This means that in order to accomplish what you intend to do, you will not have any inheritance set to true, and you will have to include FieldRef elements for all the fields that you want to use in your content type.

You do not specify / do not include code for how the content type was added to your list instance. Verify that this update has been updated to support removal or setting inheritance to false.

These sites support what is described here.

+1
source

All Articles