// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new ColumnDefinition
{
Description = "test",
EnforceUniqueValues = false,
Hidden = false,
Indexed = false,
Name = "Title",
Text = new TextColumn
{
AllowMultipleLines = false,
AppendChangesToExistingText = false,
LinesForEditing = 0,
MaxLength = 255,
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Sites["{site-id}"].Lists["{list-id}"].Columns.PostAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
ColumnDefinition columnDefinition = new ColumnDefinition();
columnDefinition.setDescription("test");
columnDefinition.setEnforceUniqueValues(false);
columnDefinition.setHidden(false);
columnDefinition.setIndexed(false);
columnDefinition.setName("Title");
TextColumn text = new TextColumn();
text.setAllowMultipleLines(false);
text.setAppendChangesToExistingText(false);
text.setLinesForEditing(0);
text.setMaxLength(255);
columnDefinition.setText(text);
ColumnDefinition result = graphClient.sites().bySiteId("{site-id}").lists().byListId("{list-id}").columns().post(columnDefinition);
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.column_definition import ColumnDefinition
from msgraph.generated.models.text_column import TextColumn
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = ColumnDefinition(
description = "test",
enforce_unique_values = False,
hidden = False,
indexed = False,
name = "Title",
text = TextColumn(
allow_multiple_lines = False,
append_changes_to_existing_text = False,
lines_for_editing = 0,
max_length = 255,
),
)
result = await graph_client.sites.by_site_id('site-id').lists.by_list_id('list-id').columns.post(request_body)