SPList.ContentTypesEnabled and SPList.AllowContentTypes
I have seen people are confused between ContentTypesEnabled and AllowContentTypes properties of SPList class
SPList.ContentTypesEnabled Gets a Boolean value specifying whether content types are enabled for the list or sets a Boolean value to enable/ disable content types for the list.
Returns true if the list supports content types.
first one can be used to get and set while second one lets you know wether list supports content types or not so that you can use accordingly set the first one to enable content types.
Now question appears Since allow content types is read only how to set this property . Answer is List definition.
You can set DisallowContentTypes property as true or false in list definition schema file but be cautious in using this as you are doing this in list definition :)
Post a Comment