spmeta2
spmeta2 copied to clipboard
Changing field type issue
I've created field within the list with a MultiChoiceFieldDefinition (checkboxes) but then i found out that i need to change it to ChoiceFieldDefinition (radiobuttons). So changing MultiChoiceFieldDefinition to ChoiceFieldDefinition in code leads to exception "Field or property EditFormat does not exist".
Original code
var fldState = new MultiChoiceFieldDefinition
{
AddFieldOptions = BuiltInAddFieldOptions.AddFieldInternalNameHint,
Id = new Guid("ef4ae491-5375-4464-b11f-c48514788039"),
Title = "Sate",
InternalName = "State",
Choices = new Collection<string>() {
"State 1",
"State 2",
"State 3"
},
AddToDefaultView = true
};
After changing to Choice field
var fldState = new ChoiceFieldDefinition
{
AddFieldOptions = BuiltInAddFieldOptions.AddFieldInternalNameHint,
Id = new Guid("ef4ae491-5375-4464-b11f-c48514788039"),
Title = "Sate",
InternalName = "State",
EditFormat = BuiltInChoiceFormatType.RadioButtons,
Choices = new Collection<string>() {
"State 1",
"State 2",
"State 3"
},
AddToDefaultView = true
};
So is there any way to change column behavior from multiselect to choice? or i did it smth wrong ?