Question

I'm working on a custom contenttype of the type Documentset. I want to set the alllowed contenttypes, but this is not working, it's only showing the defeult document. I read several blogs but i can't find my solution.

<?xml version="1.0" encoding="utf-8"?> 
<Elements xmlns="http://schemas.microsoft.com/sharepoint/"> 
  <!-- Parent ContentType: Document Set (0x0120D520) --> 
  <ContentType ID="0x0120D520008d2ff418027e4c31b54d155b98596748" 
               Overwrite="True" 
               Name="Custom Dossier" 
               Group="Custom group" 
               Description="Custom dossier" 
               Inherits="True" 
               Version="0"> 
    <FieldRefs> 
            <FieldRef ID="{8D6C094C-3E1F-41f4-BEE3-25B27EE09702}" Name="Dossier_Nummer" DisplayName="Dossiernummer" Required="True"  /> 
    </FieldRefs> 
    <XmlDocuments> 
      <XmlDocument NamespaceURI="http://schemas.microsoft.com/office/documentsets/allowedcontenttypes"> 
        <act:AllowedContentTypes xmlns:act="http://schemas.microsoft.com/office/documentsets/allowedcontenttypes" LastModified="05/31/2012 08:46:56"> 
          <AllowedContentType id="0x0101" /> 
          <AllowedContentType id="0x0101000490d50c50624b6ca21c637ef39cd89b" /> 
        </act:AllowedContentTypes> 
      </XmlDocument> 
    </XmlDocuments> 
  </ContentType> 
</Elements> 
Was it helpful?

Solution

Please try and set the Inherits attribute on the content type to FALSE. There is a bug in the feature framework that causes any declaration to be silently ignored if the inherit attribute is set to true (wiich in turn, by Murphy law, is true by default). I suspect that this should be your case (I don't think that any CU/SP fixed the bug as today).

Just remember to compensate for the Inherits="False" attribute... and lit a candle to the SharePoint dev deity if you didn't have 8 children content types to update also...

OTHER TIPS

I have a work-around where you can create your Doc Set content type, set Inherits="True", and still keep all your custom XMLDocuments. Basically the idea is to use a feature receiver on the feature where you deploy your ctype definitions, pull out the elements.xml files, and copy your XMLDocuments into the ctype defs on the site (which have ignored your changes because Inherits="True"). I have some example code on my blog:

http://morefunthanapokeintheeye.blogspot.com/2012/10/how-to-successfully-publish-custom.html

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top