Reputation: 2390
I'm trying to create a feature that both creates a list template and an instance of that list (using the <ListTemplate
> and <ListInstance
> elements. I would like for content approval to be turned on by default. According to the docs on ListTemplate, setting the EnableModeration attribute to TRUE should do it. However, when I try to install the solution, I get the following error:
The 'EnableModeration' attribute is invalid - The value 'TRUE' is invalid according to its datatype 'http://schemas.microsoft.com/sharepoint/:TrueFalseMixed' - The Enumeration constraint failed.
A bit more searching reveals that the value accepted is actually "True", not "TRUE". That installs fine, but it seems to have no effect when the list is created - it still doesn't require content approval. Any idea what I'm doing wrong?
Edit: If anyone could even confirm for me if they've seen "True" or "TRUE" work before, that would at least narrow down my search.
Update: I've found that I can enable content approval using code in a feature receiver:
list.EnableModeration = true;
list.Update();
That's a bit of a hack, so it'd still be nice to be able to do this through the XML instead.
Upvotes: 2
Views: 7178
Reputation: 4239
I had similar question - where to enable versioning and moderation from code.
In ListInstance
, go to <ListTemplate>
and set following attributes:
VersioningEnabled="TRUE"
for versioning and EnableModeration="True"
for automatic moderation.
Link: http://msdn.microsoft.com/en-us/library/ms462947.aspx
Upvotes: 0
Reputation: 23
You only have to set ModeratedList="TRUE" for List element and EnableModerate="True" for ListTemplate element. I just checked that and work fine for me. But this only will be affected for new list instances.
Upvotes: 1
Reputation: 11
I set ModeratedList="TRUE" ModerationType="TRUE" for List element and EnableModerate="True" for ListTemplate element . It works for me. Well it does not matter to use TRUE or True both are same.
Upvotes: 1
Reputation: 2390
I ended up just using the feature receiver approach, since I just needed to move on. However, I later found that the List element used for defining your list schema also has ModeratedList and ModerationType properties that look like they probably have something to do with this. So if anyone else is having the same problem, I would recommend giving those a shot.
Upvotes: 2
Reputation: 15931
Does your custom list have a field of type 'ModStat' on it?
ModStat Specifies Content Approval status. Corresponds to the SPFieldModStat class and to the ModStat field type that is specified on the Field element. Value = 23.
from the SPFieldType Enumeration docs
Upvotes: 1