1

I have just over 800 records i'm trying to update but I keep getting timeout error despite the fact i'm setting the timeout to indefinite like below:- clientContext.RequestTimeout = -1

see my snippet code below

function updateMultipleListItems() 
    {   
    var itemArray = [];
    var clientContext = SP.ClientContext.get_current();

    //Stop it from timing out (infinite) but doesn't work
    clientContext.RequestTimeout = -1;

    var oList = clientContext.get_web().get_lists().getByTitle('Test');

     while(ListItemToBeUpdated.moveNext())
     {
        var oItem = ListItemToBeUpdated.get_current();
        var oListItem = oList.getItemById(oItem.get_id());
        console.log(oListItem);
        console.log(oItem.get_id());

        oListItem.set_item('UpdateField', 'Update');  
        oListItem.update();
        console..log("updated yes");
        itemArray.push(oListItem);
        clientContext.load(itemArray[itemArray.length-1]);
     }  
    clientContext.executeQueryAsync(updateMultipleListItemsSuccess, updateMultipleListItemsFailed);
}

any help would be appreciated Thanks

  • Try this one clientContext.RequestTimeout = System.Threading.Timeout.Infinite; – Ankit Katiyar Nov 24 '18 at 8:47
  • Thanks Ankit but is there any differences with clientContext.RequestTimeout = -1 ? – naijacoder Nov 25 '18 at 12:14
  • Hi Ankit, The System.Threading.Timeout.Infinite; didn't make any difference. Still getting the timeout error – naijacoder Nov 26 '18 at 4:47
  • I had the same issue and setting the time to infinite worked for me. Could you let me know where are you running this code. Like in a console application or in a SharePoint page. Because I have often seen that when the system goes into sleep mode after a long idle time the console application stops working. – Ankit Katiyar Nov 26 '18 at 5:40
  • Its javascript using CSOM on a webpage – naijacoder Nov 26 '18 at 7:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.