Here’s something I couldn’t seem to find documented anywhere…

If you’ve programmatically created a new Yes/No field and added it to SharePoint, you don’t want to set the default value like this:

booleanField.DefaultValue = "No";


booleanField.DefaultValue = "Yes";

Doing so caused the following error when I was trying to create folders programmatically in the List that was inheriting the Content Type with that field.

Microsoft.SharePoint.SPException: Invalid Yes/No value
A Yes/No field contains invalid data. It should be either 1 or 0. Please check the value and try again.

That made me scratch my head for a while since the property takes a string and the values in the UI when you set it is Yes or No. How you should set that property is:

booleanField.DefaultValue = "0";


booleanField.DefaultValue = "1";