Create a new item in a list shows exception. Example from documentation.

Yuri Ageev 0 Reputation points
2023-09-03T18:19:24.3766667+00:00

Hello,

There is an example from Graph REST API v1.0:

// Code snippets are only available for the latest version. Current version is 5.x

var graphClient = new GraphServiceClient(requestAdapter);

var requestBody = new ListItem
{
	Fields = new FieldValueSet
	{
		AdditionalData = new Dictionary<string, object>
		{
			{
				"Title" , "Widget"
			},
			{
				"Color" , "Purple"
			},
			{
				"Weight" , 32
			},
		},
	},
};
var result = await graphClient.Sites["{site-id}"].Lists["{list-id}"].Items.PostAsync(requestBody);

You can find this example here:

https://learn.microsoft.com/en-us/graph/api/listitem-create?view=graph-rest-1.0&tabs=csharp

The exception shows follow message:

User's image

What is root cause here?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,003 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.