Share via


SharePoint 2013 List operations programmatically using CSOM

 

Hello Everyone,

To perform operations programmatically SharePoint List using CSOM there are different operations on SharePoint List using CSOM below are the basic operations :-

1) Create SharePoint List programmatically using CSOM

After creating share point list first you need to create the columns if you are using custom column and then you can associate these columns to the list.

Coding blog to create a list for given site:-

After creating a list we need to associate the columns now if you are associating the column you need to see its lookup column or not if it’s a look up field then you need to change the xml field type. Coding blog to add field to list for given site:-

 

2) Read SharePoint List programmatically using CSOM

 

To read the list first you need to connect to the list and then you need to read items

Coding blog to get a list for given site:

 

To Query items in the giving list you can use CamlQuery, below is the example if we you want to retrieve student records. If you know the listItemId than below is the coding block to get ListItem.

 

You can use Caml Query to iterate or Query the list after CAML Query you will get List Item Collection which can be iterated. Below code base is the to use CAML Query

 

 

3) Update SharePoint List programmatically using CSOM

To update SharePoint List you need to get the list and update the attribute of list then by doing list list.Update() .

 

 

4) Delete SharePoint List programmatically using CSOM

To delete the SharePoint List item you need to get the list item by title or by ID

Happy Coding!!!