Question

I fear that this is indeed a bug, but I'm asking just to be sure (SP1 and the CU haven't provided any change to the issue).

I have a document library that utilize multiple document set content type (they don't need to be related each other). Each of the set content type allow only for a specified child item content type. The allowed content types are different for each document set type. To be clearer:

  • Document set conten-type "Set-A" allows only items of content type "Item-A",
  • Document set conten-type "Set-B" allows only items of content type "Item-B"

and so on.

Problem is that if you add all the set content type to the same document library the allowed content types don't see to be enforced. User can create a document set of type "Set-A", upload a document and select the content type "Item-B" from the content type dropdown. Basically it would seem that SharePoint pick a random (my observation suggest the first found) child content type to be the default one for all the document set... so you would end (for example) with Set-A allowing only item of type Item-A and Set-B allowing both item of type Item-A and Item-B.

No code is needed to replicate the issue. All step can be completed from the SharePoint UI. I'm even able to reproduce the issue on a vanilla web site... just create two document set content type, add the Form CT as the only allowed CT on the first one and the Picture one on the other and add them to a document library -all (but one) of the document set get "bugged" and user can add item with an un-allowed content type to the them. I have also tried to reproduce the issue on multiple SharePoint 2010 VM hoping that something went wrong with my installation but to no avail - the behavior is exactly the same each time...

I'm missing something obvious or this is indeed a bug/unwanted behavior? Anyone has experienced this problem and find a solution?

Was it helpful?

Solution

SharePoint 2010 takes the document library's default Content Type (which by default is the first CT) as the CT of the document being uploaded in the Document Set, even when it's not an allowed CT of that Document Set. (which indeed seems to be a bug)

The "New Document" ribbon item does however show the right Content Types that are allowed in the Document Set (as intended).

One possible solution is to check the content type on the document added in the ItemAdded event and change it, or return an error.

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