Freitag, 16. November 2012

Hide the title column in a custom content type

One of the problem which I had most of the time when I tried to create a custom content type was "How can I hide title column in my custom conten type?"

The Solution is very easy. You must break the Inherits from item and add RemoveFieldRef to your content type definition :-).

Hier is a code example which can you use as an example for you:

<pre class="brush: xml">// Comment
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <!-- Parent ContentType: Item (0x01) -->
  <ContentType ID="0x01006ffb64509c2341d2bff13b98859f792b" Name="MyTestCT" Description="My Content Type" Inherits="FALSE" Version="0">
    <FieldRefs>
      <RemoveFieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" />
      <FieldRef ID="{38B8C4D9-6048-44A3-A092-BB11DD7F6861}"  Name="MyNewfield" Required="TRUE"></FieldRef>
    </FieldRefs>
  </ContentType>
  <Field ID="{38B8C4D9-6048-44A3-A092-BB11DD7F6861}" Name="MyNewfield" Group="My Cloumns" DisplayName="My New Field" Description="My New Field" Type="Text" Required="TRUE"/> 
</Elements>
</pre>

Keine Kommentare:

Kommentar veröffentlichen

The content type is part of an application feature

Recently I had the problem in a production environment that after the deactivation of a feature I was not able to delete the content ty...