Here, we are going to perform the most useful operation which can be performed in SharePoint platform to make our lives easier. We will learn how to create and update list items in batches using CSOM. Using this we can update a huge number of list items in a list. Please follow the below steps to understand the code better.
Step 1
Set the credential by giving input of user ID and Password for SharePoint.
Step 2
Using client context get the web & a list in which we want to update the list items.
Step 3
Using the schema AddFieldAsXML, we can add our custom field as per our requirement. (Here I have created a text field).
Step 4
Now in this step we will create 20 list items in each field present in the list & update the items using the for loop. We are using for loop for the batch update, only we have to change the condition value of ‘ i ’(e.g. here we used i<20).
Now, check the complete code below.
After running the code, we can go to our respective List and check for the items which are now created successfully.
For the output please refer to the below image