I am trying to update ~2000 list items with SPWeb.ProcessBatchData. After exception on all items at a time, I tried them in small batches like 100 and 200 but after executing first 1 or 2 batches i.e. after updating ~400 list items following exception occurs.

System.Threading.ThreadAbortException: Thread was being aborted.
   at Microsoft.SharePoint.Library.SPRequestInternalClass.ProcessBatchData(String bstrUrl, String bstrData, ISPDataCallback pResultCallback)
   at Microsoft.SharePoint.Library.SPRequest.ProcessBatchData(String bstrUrl, String bstrData, ISPDataCallback pResultCallback)
   at Microsoft.SharePoint.SPWeb.ProcessBatchData(String strBatchData)

Following is the code i used to update list items:

            var list = web.Lists["ListName"];
            var listGuid = list.ID;

            for (int i = 0; i < clients.Count; i++)
                StringBuilder query = new StringBuilder();
                for (int j = 0; j < 100 && i < items.Count; j++, i++)
                    var client = items[i];
                    query.AppendFormat("<Method ID=\"{0}\">" +
                            "<SetList>{1}</SetList>" +
                            "<SetVar Name=\"ID\">{4}</SetVar>" +
                            "<SetVar Name=\"Cmd\">Save</SetVar>" +
                            "<SetVar Name=\"{3}{5}\">{2}</SetVar>" +
                         "</Method>", i + 1, listGuid, DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ssZ"), "urn:schemas-microsoft-com:office:office#"
                         , client.ID, DateFieldName);

                var t = string.Format("<?xml version=\"1.0\" encoding=\"UTF-8\"?><ows:Batch OnError=\"Return\">" +
                                      "{0}</ows:Batch>", query);

                var result = web.ProcessBatchData(t);                

Do anyone know why this exception is coming? What is the solution for it? Your help is appreciated. Thanks in advance.

  • in your web.config what values are defined here? <httpRuntime executionTimeout="??" maxRequestLength="??" />
    – Gwny
    Jul 10, 2015 at 8:45
  • @Gwny <httpRuntime maxRequestLength="51200" requestValidationMode="2.0" executionTimeout="200" />
    – Ashish
    Jul 10, 2015 at 9:11
  • and how long does it take? maybe the execution Timeout is your problem?
    – Gwny
    Jul 10, 2015 at 9:25
  • It is taking ~100 seconds for 100 records. Is it the ideal time for updating 100 items?
    – Ashish
    Jul 10, 2015 at 9:35

1 Answer 1


The executionTimeout in web.config specifies the maximum number of seconds that a request is allowed to execute before being automatically shut down by ASP.NET.

Try setting it to at least 2000 seconds for your 2000 Items.

<httpRuntime maxRequestLength="51200" requestValidationMode="2.0" executionTimeout="2000" />

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.