Trying to create a list item in the SharePoint list in a batch of 5 using Visual Studio but the clientContext.ExecuteQuery()
throws exception and only create 1 list item.
var url = "calling a webservice";
var content = syncClient.DownloadString(url);
JsonResultInfo jsri = new JsonResultInfo();
List<JsonResult> dynJson = JsonConvert.DeserializeObject<List<JsonResult>>(content);
//Connect to SharePoint and read Idea list
List item
CamlQuery query = new CamlQuery(); string siteUrl = "sharepoint site list url"; ClientContext clientContext = new ClientContext(siteUrl); SP.List oList = clientContext.Web.Lists.GetByTitle("LIST NAME"); ListItemCollection listItems = oList.GetItems(query); clientContext.RequestTimeout = -1; clientContext.Load(listItems); clientContext.ExecuteQuery();| oListItem["title] = item.title; oListItem["body"] = item.body; oListItem.Update(); itemCount++;
get itemcount to 5 , then
clientContext.ExecuteQuery();
// the execption is thrown saying
A first chance exception of type 'Microsoft.SharePoint.Client.ServerException'
occurred in
Microsoft.SharePoint.Client.Runtime.dll
ps: Added Request timeout , and gave this exception