3

I have requirement to create multiple content types to a single website in Sharepoint 2013, I have did it using the template files, but the problem in for all newly created content types the parent Content Type is Document, Please suggest me a way how to change the "Parent Content Type" programatically using C#

Thanks in advance K Harsha

1 Answer 1

7

TLDR: You have to re-create the content types using the correct parent content type!

You cannot change the parent content type of a content type:

  • The Parent property is read-only.
  • The content type ID is prefixed with the parent content type's ID. See explanation below copied from here. This is for SP 2010 but it works the same for SP 2013 and later versions of SharePoint, including SP Online.

Content type IDs uniquely identify the content type and are designed to be recursive. The content type ID encapsulates that content type's lineage, or the line of parent content types from which the content type inherits. Each content type ID contains the ID of the parent content type, which in turn contains the ID of that content type's parent, and so on, ultimately back to and including the System content type ID. SharePoint Foundation uses this information to determine the relationship between content types and for push-down operations.

You can construct a valid content type ID using one of two conventions:

  • Parent content type ID + two hexadecimal values (the two hexadecimal values cannot be "00")
  • Parent content type ID + "00" + hexadecimal GUID
1
  • Thank u Mihail Popa, I wil try with that solution and i wil let u know
    – KHV
    Commented Jun 29, 2016 at 8:45

Your Answer

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

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