2

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

6

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
  • Thank u Mihail Popa, I wil try with that solution and i wil let u know – KHV Jun 29 '16 at 8:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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