Provision Document Set + XMLDocuments and ???
SharePoint development is fraught with frustrations. Little things that should be simple, end up taking far longer than they should. Take this example. I’m trying to provision a Document Set content type via XML in a VS feature. I was using this video and the supporting article as a guide. I get all the way through, and everything is working… ish. That is, the Document Set content type is created, but the extra stuff to do with it, such as the custom welcome page and the extra properties (shared fields, etc.), defined in the XmlDocuments section of the content type, don’t appear. No manner of tweaking and reducing code had any effect. I got a hold of the source code from the tutorial - lo and behold, that works fine. So the theory is sound, it should work, and so something somewhere was different. The job was tracking down said difference.
After a day and half, I was exasperated and set to give up. I’d found lots of people out on the internet, either with working solutions or with the same or very similar problem, but no solution. One final round of Google-bashing and found an innocent little post on MSDN. Near the bottom is the solution.
It is a bug that was reported elsewhere in this forum. The bug is triggered when you set Inherits=”TRUE” in the content type definition; it will then ignore any
tag you put in. Presumably, it will simply inherit the parent’s XmlDocuments, rather than appending them to the ones you provide. The good news, then, is that you can “fix” the problem by setting Inherits=”FALSE”. The bad news is that you then have to put in manually everything that should be inherited.
That’s right, if your Document Set content type is set to inherit, then all your customisations are ignored. Unbelievable. So there you have it…
Edit 31/10/2012! Fortunately, my not-a-real-fix “fix” wasn’t good enough for Dylan, who went ahead and worked out how to solve this issue. Alright, so it’s a pretty lengthy workaround that we just shouldn’t have to do, but hey, that’s SharePoint dev for you. So check it out, in a two-part post, starting here.