On my current project I’m working on providing end users with a custom list template that creates a new Wiki page library with versioning, content approval and draft item visibility set to Approvers only.
I created a new feature for my new ListTemplate with specified the Elements file and the location of the schema.xml file which is used when the list instance is provisioned. One thing to note with the schema.xml file is that it has to be in a folder that has the same name as the ListTemplate being defined. There is a good blog post that goes into a lot more detail about how to structure your ListTemplate feature here http://blogit.create.pt/blogs/andrevala/archive/2008/05/17/SharePoint-2007-Deployment_3A00_-List-Template-Features.aspx
My feature file looked like this:
Title=“Moderated Wiki List Template Feature”
Description=“Creates a moderated Wiki list template in the site.”
<ElementManifest Location=“Elements.xml“ />
<ElementFile Location=“ModeratedWikiTemplate\schema.xml“ />
My Elements file looked like this:
<?xml version=“1.0“ encoding=“utf-8“ ?>
DisplayName=“Moderated Wiki Page Library”
Description=“A moderated Wiki page library.”
I was struggling to get this working once provisioned; I looked in the MSDN documentation for the ListTemplate element and saw that there are attributes called VersioningEnabled and EnableModeration. I set these both to TRUE and instantly found that there was an issue with the EnableModeration value. Basically the docs say that you need to set it to TRUE when in fact the value has to be True (yes it’s case sensitive). You can see the correct way of setting the attribute above.
After re-deploying the feature I found that this time the list template appeared on the site and I was able to create list instances from it but when I looked that the list settings I found that content approval wasn’t switched on. Further digging around led me to the schema.xml file.
In the schema.xml file there is a root element called List, looking at the MSDN documentation for this showed me that there were a couple of properties I could set on this element to do with versioning and content approval, namely ModerationType, ModeratedList and VersioningEnabled. I set these three attributes to true and re-deployed the feature.
<List xmlns:ows=“Microsoft SharePoint”
This time when I created a list instance from the list template I had content approval and versioning enabled. You can also set the DraftVersionVisibility attribute to control who can see draft versions of the list items.
So basically you may need a combination of settings in both the ListTemplate and List elements to achieve was you need with list definitions.
NOTE: This was for a MOSS 2007 project but I’m guessing the same works for SharePoint 2010 but haven’t tried it.