SharePoint Developer Center > SharePoint 2010 Forums > SharePoint 2010 - General Questions and Answers > Content Type creation problem - A duplicate content type was found

Answered Content Type creation problem - A duplicate content type was found

  • Monday, January 24, 2011 9:59 PM
     
      Has Code

    Hi,

    I'm having this problem and I didnt find any answers on the web. 

    I have a content type named "Document X" with the original "Document" as parent.

    When I create a new content type named "Document X 2" with the parent "Document X", I get the error "A duplicate content type 'Document X 2' was found"...

    I checked the ULS and the error isn't reported there. I can create new content type from any other content type (out of the box or others I created) but I cant create new one from that "Document X". (And no I dont have any content type named like that.. whatever name I use, I get the same error)

    Full error is:

    A duplicate content type "Document X" was found.
    Troubleshoot issues with Microsoft SharePoint Foundation.
    Correlation ID: b9d36bb8-1a8e-4ef4-bbd0-fbdf8e70d73b
    Date and Time: 1/24/2011 3:00:36 PM

    I know I dont have much info to give here, I just dont know where to look first.. 

    This error is happening on my content type hub site but I use and create content type on this site only.

    If anyone have any idea that could help me, I would really appreciate it as I lost a few hours on this already and dont know where to look anymore... 

    Thanks a lot,

    JP Berube

Answers

  • Thursday, January 27, 2011 7:02 PM
     
     Answered Has Code
    I found my problem, so if this can help someone some day.
    Looks like SharePoint have some problems sometimes to update a field in the content database.
    The field NextChildByte from the dbo.ContentTypes table is the problem. Lets say I create a content type with ID 0x010100ACEA2663B318874AA9192CA9AF678614 with Document as parent (0x0101)
    SharePoint will create an entry in the dbo.ContentTypes table.
    When I create an other content type with the first one as parent.. The ID of this new content type will be 0x010100ACEA2663B318874AA9192CA9AF67861401) This 01 came from the NextChildByte field from the dbo.ContentTypes table.
    Now SharePoint should update the dbo.ContentTypes table and set the field NextChildByte to 2 so the next content type created using the same parent will be 0x010100ACEA2663B318874AA9192CA9AF67861402.
    My problem was.. SharePoint didnt update the NextChildByte field so SharePoint was trying to create a content type with ID 0x010100ACEA2663B318874AA9192CA9AF67861401 when it already existed... The mistake shown 
    To solve the problem the dirty way, you can update the dbo.ContentTypes table and set the NextChildByte to 2 (or use any greater value). Looks like this:

    UPDATE ContentTypes SET NextChildByte = 2 WHERE ContentTypeId = 0x010100ACEA2663B318874AA9192CA9AF678614
    

    But in my case, I've been able to delete my content type 0x010100ACEA2663B318874AA9192CA9AF67861401 and recreate it. The new content type ID was 0x010100ACEA2663B318874AA9192CA9AF67861401 again since NextChildByte of the parent was still set to 1. However the NextChildByte of my parent content type (0x010100ACEA2663B318874AA9192CA9AF678614) was automaticly increased to 2, which is the normal behavior.

    Cheers!



    • Marked As Answer by JP Berube Thursday, January 27, 2011 7:17 PM
    • Edited by JP Berube Wednesday, June 08, 2011 11:26 PM
    •  
  • Wednesday, June 22, 2011 8:38 PM
     
     Answered

    I am sure that a lot of people visiting this site feel uneasy about updating the content database directly. That is where I was at when I found posts like this, and so I continued to research it until I could find a way to fix it without working with the database directly, and I was able to do so. I hope this helps someone out.

    Cheers.

    http://www.mattjimison.com/blog/2011/06/21/a-duplicate-content-type-found-error/

    • Marked As Answer by JP Berube Thursday, June 23, 2011 12:54 PM
    •  

All Replies

  • Monday, January 24, 2011 11:55 PM
     
     

    Here is a post from this MSDN site which I found to be most helpful to me on this topic.

    Here is a post which shows how the inheritence of content types takes place. How it uses a base ID and adds the GUID of the new document or content to show how the inheritence path works.

     http://blogs.msdn.com/b/eigilm/archive/2007/09/04/inherit-content-types.aspx

    when I was going over your problem I found this site to be most helpful in understanding other ways to create it and change it to make it work for you.  Hope this helps.

     

    http://social.technet.microsoft.com/Forums/en-GB/sharepoint2010programming/thread/ca7b97ee-6f03-4beb-b7b8-7aa20227ac6e

     

    Gary


    Gary Newman MCSE, MCT, CCNA MCDBA, MCAD, MCSA MCTS SharePoint 2007 Dev & Admin MCPD SharePoint 2010 Development
  • Tuesday, January 25, 2011 1:08 AM
     
     

    Ok Now I think I understand that the ID is the problem but still dont know how to solve it. I already have a content type that inherits from my "Document X" so when I try to create an other one, it tries to use the same ID..

    So my "Document X" have an ID of 0x010100 + GUID

    and my "Document X 1" that inherits from "Document X" have an ID of 0x010100 + GUID of parent + 01

    How can I create an other content type that inherits from "Document X" with an ID of (by exemple) 0x010100 + GUID of parent + 02 ???

    Can I manage that from the Site Settings??

  • Tuesday, January 25, 2011 9:16 AM
     
     

    You've pointed it out right. In this MSDN article it says:

    Parent content type ID: 0x01
    Site content type ID:   0x0100A33D9AD9805788419BDAAC2CCB37509F
    List content type ID:   0x0100A33D9AD9805788419BDAAC2CCB37509F006454F8883E8BA648A632E5ACB47CAD9B

    Follow that logic. SharePoint internally uses .StartsWith (or BeginsWith) to determine CT hierarchy.

    I usually stick to the "00" + GUID +"00" + GUID scheme.

    If you are ever confused, use the Site Settings/UI to create them, then open up SharePoint Manager 2010 and check their ID's. Then change a few digits around and use it in your solution.

    Hope this helps!


    SharePoint 2010 MCM. Feel free to contact me http://www.sharepoint.bg/radi
  • Tuesday, January 25, 2011 2:56 PM
     
     

    What I dont understand is why SharePoint doesnt manage that when I create new content type using the "Site Settings / site content type / create" option

    Lets say I have a content type I create with the ID 0x010100ACEA2663B318874AA9192CA9AF678614

    I created a other with the last one as parent, now it gives me the ID 0x010100ACEA2663B318874AA9192CA9AF67861401

    Usually when I create a third one using the first one as parent, SharePoint gives me the ID 0x010100ACEA2663B318874AA9192CA9AF67861402 but here, with that specific content type, it doesnt work...

    the parent content type was deploy with a sandbox solution, but I dont want to add the child one using visual studio or designer as its the site administrator that will add the new content types....

    Why SharePoint doest manage that for me in that case?? And I get the same error when I create the content type from SP Designer...

  • Thursday, January 27, 2011 7:02 PM
     
     Answered Has Code
    I found my problem, so if this can help someone some day.
    Looks like SharePoint have some problems sometimes to update a field in the content database.
    The field NextChildByte from the dbo.ContentTypes table is the problem. Lets say I create a content type with ID 0x010100ACEA2663B318874AA9192CA9AF678614 with Document as parent (0x0101)
    SharePoint will create an entry in the dbo.ContentTypes table.
    When I create an other content type with the first one as parent.. The ID of this new content type will be 0x010100ACEA2663B318874AA9192CA9AF67861401) This 01 came from the NextChildByte field from the dbo.ContentTypes table.
    Now SharePoint should update the dbo.ContentTypes table and set the field NextChildByte to 2 so the next content type created using the same parent will be 0x010100ACEA2663B318874AA9192CA9AF67861402.
    My problem was.. SharePoint didnt update the NextChildByte field so SharePoint was trying to create a content type with ID 0x010100ACEA2663B318874AA9192CA9AF67861401 when it already existed... The mistake shown 
    To solve the problem the dirty way, you can update the dbo.ContentTypes table and set the NextChildByte to 2 (or use any greater value). Looks like this:

    UPDATE ContentTypes SET NextChildByte = 2 WHERE ContentTypeId = 0x010100ACEA2663B318874AA9192CA9AF678614
    

    But in my case, I've been able to delete my content type 0x010100ACEA2663B318874AA9192CA9AF67861401 and recreate it. The new content type ID was 0x010100ACEA2663B318874AA9192CA9AF67861401 again since NextChildByte of the parent was still set to 1. However the NextChildByte of my parent content type (0x010100ACEA2663B318874AA9192CA9AF678614) was automaticly increased to 2, which is the normal behavior.

    Cheers!



    • Marked As Answer by JP Berube Thursday, January 27, 2011 7:17 PM
    • Edited by JP Berube Wednesday, June 08, 2011 11:26 PM
    •  
  • Tuesday, May 24, 2011 7:35 PM
     
     

    Just a thought, but I'd like some feedback from Microsoft in relation to this solution. The SharePoint licensing agreement states that any modification of the content database voids the product's warranty/supportability from Microsoft. Does this qualify as acceptable practice?

  • Wednesday, June 08, 2011 10:07 PM
     
     

    Hi all,

    I had the same problem, but I was experimenting with bulk adding and deleting content types with powershell. Once I deleted the contenttypes (some where inheritting) on my CType Hub, I could never add the same bunch agan. I adapted the ID's of the contenttypes in my import/export files to re-add them. This is ofcourse only a workaround, but worked for me and beets having to remove the Hub and the MM Service App, to start over.

    I hope MS will fix this.

    regards.

  • Wednesday, June 22, 2011 8:38 PM
     
     Answered

    I am sure that a lot of people visiting this site feel uneasy about updating the content database directly. That is where I was at when I found posts like this, and so I continued to research it until I could find a way to fix it without working with the database directly, and I was able to do so. I hope this helps someone out.

    Cheers.

    http://www.mattjimison.com/blog/2011/06/21/a-duplicate-content-type-found-error/

    • Marked As Answer by JP Berube Thursday, June 23, 2011 12:54 PM
    •