Interesting thing happened to me today, and I guess I’ve seen it happening at least 10 times in the past but I keep forgetting what the solution was every time I see it again.
Say you create a multiple lines of text field in a list (Note field type of class SPFieldMultiLineText).
Now, you want to make sure it supports HTML but you want to do it via code.
The simple thing to do appears to be:
SPFieldMultiLineText myField = …;
myField.RichText = true;
myField.RichTextMode = FullHtml;
Run that code again, you will find that the RichText and RichTextMode properties were not modified.
Even calling list.Update() doesn’t help.
Apparently, the simple solution is to edit and set the myField.SchemaXml property directly, without calling myField.Update() after. Simple, yet annoying.
Here is an example of a working code: