views:

457

answers:

2

Hi guys,

I'm creating some content types in a feature for a publishing site in SP2010 RC using VS2010, and I am unable to remove the out-of-the-box Contact fields included in the Page content type with RemoveFieldRef. My definition looks like:

  <ContentType ID="0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900a10c9f46e3b0489a96c510a54038a558"
               Name="CustomPage"
               Group="MyGroup"
               Description="My content type"
               Inherits="TRUE"
               Version="0">
    <FieldRefs>
      <RemoveFieldRef ID="{aea1a4dd-0f19-417d-8721-95a1d28762ab}" Name="PublishingContact"/>
      <RemoveFieldRef ID="{c79dba91-e60b-400e-973d-c6d06f192720}" Name="PublishingContactEmail"/>
      <RemoveFieldRef ID="{7546ad0d-6c33-4501-b470-fb3003ca14ba}" Name="PublishingContactName"/>
      <RemoveFieldRef ID="{dc47d55f-9bf9-494a-8d5b-e619214dd19a}" Name="PublishingContactPicture"/>
      <FieldRef ID="{BEAC7028-777F-4f1d-ACE0-A61A4302A0D6}" Name="Description"/>
      <FieldRef ID="{A2CBC8CE-04D5-4403-A929-F1E0779A9CF2}" Name="UsefulLinks"/>
      <FieldRef ID="{9dd17ea7-6dda-46f4-91ec-0beaa81e508b}" Name="Contacts"/>
    </FieldRefs>
  </ContentType>

Can anyone shed some light on why the fields still appear when I go to have a look at the content type after feature activation in Site Settings -> Content Types?

A: 

Remove Inherits="TRUE" and try again.

Since you tagged the question as sharepoint2010, I tried to replicate the error in my SharePoint 2010 development environment. Visual Studio 2010 would not let me build and deploy until I removed the Inherits line. Once it was removed, the solution built and deployed without problem. I then went to Site Settings > Site Content Types > CustomPage. The only columns in the Content Type were as follows: Name, Title, Comments, Scheduling Start Date, Scheduling End Date, Rollup Image, and Target Audiences.

Rich Bennema
Hi Rich, are you running Visual Studio 2010 beta or RC? I generated the content type using VS2010 RC and the inherits option comes up by default, but I can't find any information on this attribute on MSDN or anywhere - without the inherits attribute, I get the following error:"Error occurred in deployment step 'Activate Features': The parent content type specified by content type identifier 0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF39 does not exist."
Blakomen
RC. And you're correct, I created a new Content Type (instead of just pasting the XML) item and Inherits was added (and immediately underlined in blue). Looks like a bug. Regarding your new error, make sure you are deploying to a Publishing site, otherwise the Page Content Type won't exist. You can confirm Page exists with the following URL: http:// yoursitecollectionpath/_layouts/ManageContentType.aspx?ctype=0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF39
Rich Bennema
A: 

Remove Inherits="TRUE" and try again, Works for me as well, the reason what I found in my case is that I inherit content type from (publishing)Page and try to deploy the feature on teamsite. The parent content type I specified was wrong.

nouman