// Get library columns collection.
var libFields = list.Fields;
clientContext.Load(libFields);
clientContext.ExecuteQuery();
Microsoft.SharePoint.Client.File newFile = clientContext.Web.GetFileByServerRelativeUrl(fileUrl);
ListItem item1 = newFile.ListItemAllFields;
var fileN = fileName;
clientContext.Load(item1);//Load the new item
clientContext.ExecuteQuery();
// Console.WriteLine("ID of new item:{0}", newItem.Id);//Get ID
item1.Id
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!";
newItem.Update();
context.Load(newItem);//Load the new item
context.ExecuteQuery();
Console.WriteLine("ID of new item:{0}", newItem.Id);//Get ID
No comments:
Post a Comment