Create a columnDefinition in a list (DefaultValue not set)

Create a columnDefinition in a list (DefaultValue not set)



 Oct 12 2021



This is a repost of an issue posted here: 

(after review from CarlZhao-MSFT I am now posting this idea as I/we believe this functionality is missing)


The problem/bug is that when either:

Creating af Sharepoint List Column or
Updating an existing Sharepoint List Column
Then is is possible to set almost all elements for the Column, but not the DefaultValue.
I can see on StackOverflow that there is another report, but I have not managed to find a solution:
Issue on StackOverflow

Test-1 - Graph Explorer - Update existing Sharepoint List Column

In Graph Explorer - construct the Column to PATCH (example below is a textColumn):

{ "defaultValue": { "value": "cba" } }

Press "Run Query"
The response Preview shows the updated Column, but the "DefaultValue" has not changed (I have tried including other parameters as e.g. "required" and "displayName" which updates correctly).
Test-2 - msgraph-sdk-dotnet - Creating a new Column (example below is a choiceColumn but I have also tried textColumn):

Snippet of the C# code to create - example:

 Microsoft.Graph.ColumnDefinition column = new Microsoft.Graph.ColumnDefinition { 
 DisplayName = "Choice Field", 
 Name = "ChoiceField", 
 Choice = new ChoiceColumn { 
 ODataType= "microsoft.graph.choiceColumn", 
 AllowTextEntry = false, 
 Choices = new List<string>() { "Yes", "No", "" } }, 
 DefaultValue = new DefaultColumnValue { Value = "No" }, 
 Description = "Description of the Column", Required = true }; 
 Microsoft.Graph.ColumnDefinition newColumn = await graphClient.Sites["<siteId>"].Lists["<listId>"].Columns.Request().AddAsync(column);

The Column is created with all settings - except the DefaultValue.
Could you please help with either redirecting the bug (if it actually is a bug) or tell me if I am missing something regarding the DefaultValue / DefaultColumnValue.

EDIT: After investigating, then I can attach the DefaultValue if I set it when creating the List - however it does not solve the issue regarding Adding/Editing a List Column.

I have also addressed this issue in the Github - microsoftgraph/msgraph-sdk-dotnet who told me to try to post the question/issue here.

Best Regards,

Similar Ideas
No similar ideas