Create a new item in Sharepoint list, under a given folder

Vincenzo Belvedere 0 Reputation points
2025-04-09T14:37:45.5466667+00:00

I'm trying to use microsoft Graph library in C# to insert a new row in a list in Sharepoint. the row must be under a subfolder of the list, but i can't find out how to do it through GraphServiceClient.

var listItems = await _graphClient.Sites[siteId].Lists[listId].Items.GetAsync();
foreach (var item in listItems.Value)
{
   _logger.LogInformation($"Item: {item.Id}");
}
var newItem = new ListItem
{
    Fields = new FieldValueSet
	{
		AdditionalData = new Dictionary<string, object>
            {
                 { "Title", "multiply favor" },
                 { "Value", 7.5 },
                 { "OverallScore", true },
                 { "EmailId", "4"},
             },
     },
};
var listItemCreated = await _graphClient.Sites[siteId].Lists[listId].Items.PostAsync(newItem);

i'm currently able to create an item in
/sites/<site-name>/Lists/<list-name>

but i want to write directly in

/sites/<site-name>/Lists/<list-name>/<sub-list-name

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

1 answer

Sort by: Most helpful
  1. Aashutosh Tiwari - MSFT 115 Reputation points Microsoft External Staff
    2025-04-10T12:34:58.6+00:00

    Hi Vincenzo,

    Thank you for reaching out to Microsoft!

    You can follow this documentation below:
    https://learn.microsoft.com/en-us/graph/api/site-list-subsites?view=graph-rest-1.0&tabs=http#http-request

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment

    1 person found this answer helpful.

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.