none
Custom Content Type and Title field and "inherits" element RRS feed

  • Question

  • Hello. Here is my custom content type generated with Visual Studio 2010:

    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
      <!-- Parent ContentType: Item (0x01) -->
      <ContentType ID="0x0100c2edc7fd0abe484a9ff2bbefe89cd3fa"
                   Name="Andromeda - Contact"
                   Group="Custom Content Types"
                   Description="Contact Content Type"
                   Inherits="TRUE"
                   Version="0">
        <FieldRefs>
          <FieldRef ID="{20882C94-C35D-4a3d-ACDB-F2AB80F1F81F}"
                    DisplayName="Notes"
                    Name="Notes"/>
        </FieldRefs>
      </ContentType>
    </Elements>

    The content type inherits from Item, so everything ok when I deploy and activate.

    Now, I want to make the title field non required. Other posts suggest that I should change the inherits element to false and reference the title field. Doing so, I get the following error in ULS upon activation:

    The parent content type specified by content type identifier 0x0100C2EDC7FD0ABE484A9FF2BBEFE89CD3FA does not exist

    Any ideas?

    Friday, April 29, 2011 6:41 AM

Answers

  • Hi,

           Yup i made optional through UI. I made Required="False"  in schema but after deployment it was Required=True. I guess it is inbuild field(shipped with sharepoint by default) values of field are not getting overridden.

     

    I suggest you to create new field. eg. Name="Title1" and DisplayName='Title'

     

    Regards

    Milan Chauhan

     

    • Marked as answer by Wayne Fan Friday, May 6, 2011 8:24 AM
    Friday, April 29, 2011 11:58 AM

All replies

  • Hi!

    Could you add a new FieldRef element that points to the built in Title field and set that field to required="False"?

    <FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" DisplayName="Title" Name="Title" Required="FALSE"/>
    

    Don't forget to update the schema file if you have a list instance.

    Hope this helps.


    Sebastian | MCTS
    Friday, April 29, 2011 7:04 AM
  • That was the first thing I did. There was no change at all. Title was still required. Then, I followed the answer in this post. That's where I am getting the error: "The parent content type specified by content type identifier 0x0100C2EDC7FD0ABE484A9FF2BBEFE89CD3FA does not exist"


    Another thing I tried was to include the field element for "title" in the schema of my list definition (with my original content type). I was able to modify the display name this way, but the field it is still required when I deploy:

    <Fields>
    <Field ID="{FA564E0F-0C70-4AB9-B863-0177E6DDD247}" Type="Text" Name="Title" DisplayName="Contact Name" Required="FALSE" />

    I cannot understand...

    Friday, April 29, 2011 11:01 AM
  • Hi,

        I tried replicating your issue on my local server i did following steps

      (1) Created custom content type inheriting from  Item

      (2) Added default title field reference in <fieldRef> tag

      (3) After deploying it . i made title field as Optional.

      (4) Added Content type to custom list and it worked fine.

     

    From your last post it looks like you creating new title field. You have to put it inside <filedRef> Tag.

    i.e.

      <FieldRefs>
       <FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" DisplayName="Title" Name="Title"/>
      </FieldRefs>

    Regards
    Milan Chauhan

     

     

    Friday, April 29, 2011 11:31 AM
  • Is the Title field required by your solution? If no, then remove the title field from the content type using the <RemoveFieldRef> tag and add your own field with displayname Title but with required = false.

    I can't think of another solution right now.


    Sebastian | MCTS
    Friday, April 29, 2011 11:33 AM
  • Hi Milan,

    In (3), do you mean you made the title field optional through the UI?, because this is not an option for me. I need to declare it as optional declaratively.

    Friday, April 29, 2011 11:40 AM
  • Yeah, it is required as I want to keep the link and the contextual menu functionality.

    Also, even if it was not required, <RemoveFieldRef> has no effect neither. Title field is still there. I found this post from a guy with the same problem, where he suggests doing it via the object model. But I want to be sure that it cannot be done declaratively before using object model. So, i used the tip concerning inherits element, mentioned in that post, which gives me the error mentioned above.

    Friday, April 29, 2011 11:47 AM
  • Hi,

           Yup i made optional through UI. I made Required="False"  in schema but after deployment it was Required=True. I guess it is inbuild field(shipped with sharepoint by default) values of field are not getting overridden.

     

    I suggest you to create new field. eg. Name="Title1" and DisplayName='Title'

     

    Regards

    Milan Chauhan

     

    • Marked as answer by Wayne Fan Friday, May 6, 2011 8:24 AM
    Friday, April 29, 2011 11:58 AM