MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.3k stars 21.48k forks source link

Document Correction Proposal: Create a new list #124897

Open Rukmini3394 opened 2 days ago

Rukmini3394 commented 2 days ago

Overview

The issue encountered revolves around the creation of a SharePoint list using Microsoft Graph SDK Create a SharePoint List - Microsoft Graph v1.0 | Microsoft Learn, where the property for defining the list template is incorrectly documented. The Microsoft Graph SDK documentation suggests using List, but the correct property name is ListProp. This leads to a compilation error when attempting to define the list template during the list creation process.

Correction Details

Incorrect Documentation Example:

var requestBody = new List
{
    DisplayName = "Books",
    Columns = new List<ColumnDefinition>
    {
        new ColumnDefinition
        {
            Name = "Author",
            Text = new TextColumn { }
        },
        new ColumnDefinition
        {
            Name = "PageCount",
            Number = new NumberColumn { }
        }
    },
    List = new ListInfo
    {
        Template = "genericList"
    }
};

Corrected Example:

var requestBody = new Microsoft.Graph.Models.List
{
    DisplayName = "Books",
    Columns = new List<ColumnDefinition>
    {
        new ColumnDefinition
        {
            Name = "Author",
            Text = new TextColumn { }
        },
        new ColumnDefinition
        {
            Name = "PageCount",
            Number = new NumberColumn { }
        }
    },
    // Correct property name for list template
    ListProp = new ListInfo
    {
        Template = "genericList"
    }
};

For Steps to create new list refer -

c# - Azure function app GraphServiceClient create list - Stack Overflow

Documentation Correction Justification

The existing documentation implies that the property List should be used for specifying list templates, which does not match the SDK's actual implementation. This discrepancy causes confusion for developers and leads to runtime errors. he SDK correctly uses ListProp to define the list template, but this detail is currently missing or incorrect in the documentation.

Conclusion

The issue with the Microsoft Graph SDK documentation stems from an inconsistency between the documented property List and the actual ListProp used in the SDK for defining list templates. To resolve this:

PesalaPavan commented 1 day ago

@Rukmini3394 Thanks for your feedback! We will investigate and update as appropriate.