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

Add field with CustomFormatter #1500

Open
1 task done
Mruffo opened this issue Jul 30, 2024 · 0 comments
Open
1 task done

Add field with CustomFormatter #1500

Mruffo opened this issue Jul 30, 2024 · 0 comments

Comments

@Mruffo
Copy link

Mruffo commented Jul 30, 2024

Category

  • Bug

Describe the bug

I'm trying to add a field of type 'Choice' with a custom formatter (the simplest possible by Microsoft documentation), but I got an error:

"Name cannot begin with the '$' character, hexadecimal value 0x24. Line 1, position 157"

Steps to reproduce

Sample code:

   await library.Fields.AddChoiceAsync("Test", new FieldChoiceOptions()
                    {
                        AddToDefaultView = true,
                        Choices = new List<string>() { "Value1", "Value2", "Value3" }.ToArray(),
                        CustomFormatter = "{\"$schema\": \"https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json\",\"elmType\": \"div\", \"txtContent\": \"@currentField\"}",
                        DefaultChoice = "Value1"
                    });

Expected behavior

The field is added to the library with the right json formatting

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

No branches or pull requests

1 participant