How can I get the ID of a list item that I just inserted in a list using the SP C# client library?

  • After adding the Item, get the list items and sort it with creation date and get the first time. Commented Sep 24, 2015 at 11:23
  • Maybe you find your answer here: sharepoint.stackexchange.com/questions/96493/…
    – Patrick
    Commented Sep 24, 2015 at 11:31
  • I see that using JSOM I can use the callback function to grab the ID of the recently inserted but I'm not seeing how to do that using C# Commented Sep 24, 2015 at 20:48

1 Answer 1


You can refer below sample:

ClientContext context = new ClientContext("http://SiteUrl"); 
List listObj = context.Web.Lists.GetByTitle("ListName"); 
ListItemCreationInformation itemCreateInfo = new ListItemCreationInformation(); 
ListItem newItem = listObj.AddItem(itemCreateInfo); 
newItem["Title"] = "My New Item!"; 
context.Load(newItem);//Load the new item
Console.WriteLine("ID of new item:{0}", newItem.Id);//Get ID 
  • It works! Thanks.
    – ZooZ
    Commented May 29, 2019 at 11:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.