Search This Blog

Showing posts with label How to add Items in sharepoint list using CSOM. Show all posts
Showing posts with label How to add Items in sharepoint list using CSOM. Show all posts

Wednesday, June 22, 2016

How to add Items in sharepoint list using CSOM

public void AddNewItemToList(string Title,string Subject)
{
   using(ClientContext objCtx = new ClientContext("http://Sharepoint.com"))
   {
       List oList = ctx.Web.Lists.GetByTitle("TestList");
       ListItemCreationInformation objItemCreateInfo = new ListItemCreationInformation();
       ListItemnewItem = oList.AddItem(objItemCreateInfo);
       newItem["Title"] = Title;
       newItem["Subject"] = Subject;
       newItem.Update();
       context.ExecuteQuery();
    }
}