2

I have defined a Site Content Type which has inherited fields (inherited from parent content type). Also, created new custom list definition that uses the content type created. I want to hide the inherited fields in the list definition.

I tried setting ShowinEditForm, ShowinDisplayForm, ShowinViewForm all to "FALSE", but it continues to be visible. How do I make it invisible in the list definition?

Thanks!

1 Answer 1

0

Set the Inherits attribute to False in child content type. Then add those fields which need to be hidden in the FieldRefs section using RemoveFieldRef. See this for more information: http://www.sharepointnadeem.com/2011/06/hide-parent-field-in-child-content-type.html

UPDATE

In the Schema.xml file, define the field and set its visibility properties. Example:

<List xmlns:ows="Microsoft SharePoint" Title="UserAccountRequestListDef" ModerationType="TRUE" ModeratedList="TRUE" EnableContentTypes="TRUE" DisableAttachments="TRUE" FolderCreation="FALSE" Direction="$Resources:Direction;" Url="Lists/UserAccountRequestListDef" BaseType="0" xmlns="http://schemas.microsoft.com/sharepoint/" NavigateForFormsPages="FALSE">
  <MetaData>
    <ContentTypes>
      <ContentType ID="0x01001a148caa96674ad1ae7da45d6964cbb1008f4a465fc6204289b4c51af92860e622" Name="UserAccountRequest" Group="User Content Types" Description="Use this to request a new client account" Inherits="TRUE" Version="0">
        <FieldRefs>             
          <FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" DisplayName="Last Name"/>
          <FieldRef ID="{E63469D9-EEF3-4A8B-A4B6-54250CC30509}" Name="DeactivateAccount" DisplayName="Deactivate" />
          <FieldRef ID="{607391AC-7F89-40CF-A354-1DA661F16365}" Name="AccountState" DisplayName="Account State" />
        </FieldRefs>
      </ContentType>
    </ContentTypes>
    <Fields>
        <Field ID="{607391AC-7F89-40CF-A354-1DA661F16365}"
             Name="AccountState"
             Type="Choice"
             DisplayName="Account State"
             Required="TRUE"
             EnforceUniqueValues="FALSE"
             Indexed="FALSE"
             Format="RadioButtons"
             FillInChoice="FALSE"
             ShowInDisplayForm="FALSE"
             ShowInEditForm="FALSE"
             ShowInFileDlg="FALSE"
             ShowInListSettings="FALSE"
             ShowInNewForm="FALSE"
             ShowInVersionHistory="FALSE"
             ShowInViewForms="FALSE"
             StaticName="AccountState"
             Sealed="TRUE">
        <Default>New</Default>
        <CHOICES>
          <CHOICE>New</CHOICE>
          <CHOICE>Active</CHOICE>
          <CHOICE>Inactive</CHOICE>
        </CHOICES>
      </Field>
    </Fields>
3
  • Nadeem, Thanks for the response! But I do not want to remove the field from the child content type. I just want to hide it in the List definition that uses this content type. The reason is that in the future the application might extend and these fields(fields that I am trying to hide) might be used. Hence removal is not an option. Is this possible? What does a field OverWrite element do? Can I use that?
    – ShpUser
    Dec 18, 2014 at 12:56
  • See my updated answer Dec 18, 2014 at 13:39
  • I tried setting the visibility properties and it didn't help. The field continues to be visible in all forms. <Field Type="Note" DisplayName="Description" Required="FALSE" Hidden="FALSE" ID="{bbb1f503-cf52-47c3-8e43-cc8ac71ef4bb}" Name="Description1" ShowInDisplayForm="FALSE" ShowInEditForm="FALSE" ShowInFileDlg="FALSE" ShowInListSettings="FALSE" ShowInNewForm="FALSE" ShowInVersionHistory="FALSE" ShowInViewForms="FALSE"/>
    – ShpUser
    Dec 18, 2014 at 18:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.