views:

1272

answers:

2

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.

A: 

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

Jason
I didn't create one, but I think it's on there by default. At leats I would assume so, since the feature receiver method (mentioned above) works.
Jonathan Schuster
A: 

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.

Jonathan Schuster