Update a list in the Sharepoint 2013 using CSOM

Steps
  • Open Visual Studio in your system
  • Select Console Applciation template and give as name "updateList"
  • Add a Microsoft.Cleint Assembly refrence file in right side refrence tab in visual studio.
  • Replace Program.cs with the source code
  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.Linq;  
  4. using System.Text;  
  5. using System.Threading.Tasks;  
  6. using Microsoft.SharePoint.Client;  
  7. namespace updatelist  
  8. {  
  9.     class Program   
  10.     {  
  11.         static void Main(string[] args)   
  12.         {  
  13.             // ClientContext - Get the context for the SharePoint Site    
  14.   
  15.   
  16.             ClientContext clientContext = new ClientContext("http://gauti.sharepoint.com/sites/sp/");  
  17.             // Get the SharePoint web    
  18.             Web web = clientContext.Web;  
  19.             // Get the SharePoint list by title    
  20.             List list = web.Lists.GetByTitle("updatedname");  
  21.             // Update the description for the custom list    
  22.             list.Description = "update the list  using VS2012 & CSOM";  
  23.             // Update the list    
  24.             list.Update();  
  25.             // Retrieve the list properties    
  26.             clientContext.Load(list);  
  27.             // Execute the query to the server.    
  28.             clientContext.ExecuteQuery();  
  29.             // Display the list title and description    
  30.             Console.WriteLine("List Title: " + list.Title + "; Description: " + list.Description);  
  31.             Console.ReadLine();  
  32.         }  
  33.     }  
  34. }  
Hit F5 and see the magix happend in SharePoint 2013. Hope you have enjoyed this.!!! :-)