Udostępnij za pośrednictwem


FF at the End of a Content Type ID Kills Update Propagation

I just spent a couple of hours tracking down an issue where our content type update code wasn’t working for some content types.  The problem ended up being that one content type in the hierarchy had a content type ID that ended with “FF” (such as “0x0100EBE43BB291D8438f94E2C48C129366FF”).  None of this type’s child content types were getting updated (for example, the content type with ID “0x0100EBE43BB291D8438f94E2C48C129366FF01” was not updated).

Details

When updating content types and you want those updates to push down (propagate) to child content types, you need to either do that through the SharePoint UI, or write code.  In our case, we have code in the feature receiver that adds new site columns to content types as needed.  We have a hierarchy of content types and when we update a base content type, we want those changes to be pushed down to their children, their children’s children and so on.  We do this using the SPContentType’s Update(true) method.

Even with this, none of the children of one specific content type were getting updated.  After scouring the code for clues and trying various ways of updating, I started to wonder if the ID was “special” in any way since ID’s are parsed by SharePoint (for example, a “00” tells SharePoint that the preceding characters represent the ID of a base content type).  I noticed that it ended in “FF”; all of the other types that were propagating correctly ended with other characters.  So, I changed it to end in “0E”, reactivated the feature, and the propagation worked!

So, it appears that somewhere in the SharePoint code that updates content types, “FF” has some special meaning, telling it, “stop here, don’t propagate any further.”