Search This Blog

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();
    }
}

No comments:

Post a Comment