Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing field type issue #1083

Open
HeToC opened this issue Sep 28, 2017 · 0 comments
Open

Changing field type issue #1083

HeToC opened this issue Sep 28, 2017 · 0 comments
Milestone

Comments

@HeToC
Copy link

HeToC commented Sep 28, 2017

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants