Skip to content

Create a columnDefinition in a list (DefaultValue not set) #1136

@monkeymalle

Description

@monkeymalle

Hi

I am not sure where to address this issue, but I am seeing it in both Graph Explorer and msgraph-sdk-dotnet.
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

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

  1. In Graph Explorer - construct the Column to PATCH (example below is a textColumn):
    e.g.: https://graph.microsoft.com/v1.0/sites/"siteId"/lists/"listId"/columns/"columnId"
    Body:
    { "defaultValue": { "value": "cba" } }
  2. 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):

  1. 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);
  2. 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.

Best Regards,
Martin

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions