Update A List Item In SharePoint Using CSOM (Announcement List)

In this blog, I will to add a code snippet for updating an item in a SharePoint announcement list using Client Object Model.
 
The client object model must conclude with a call to ExecuteQuery() or ExecuteQueryAsync(ClientRequestSucceededEventHandler, ClientRequestFailedEventHandler).
 
Steps
  1. Open Visual Studio in your system.
  2. Select "Console Application" template and give it name as "Enablefolder".
  3. Add a Microsoft.Client Assembly reference file in right side Reference tab in Visual Studio.
  4. Replace Program.cs with the source code below.
Code snippet 
  1. using System;  
  2. using Microsoft.SharePoint.Client;  
  3.   
  4.   
  5. namespace GowthamArticles  
  6. {  
  7.     class CreateListItem  
  8.     {  
  9.         static void Main()  
  10.         {     
  11.               
  12.             ClientContext clientContext = new ClientContext("https://gowtham.sharepoint.com/tutorials");  
  13.             List oList = clientContext.Web.Lists.GetByTitle("Announcements");  
  14.             ListItem oListItem = oList.Items.GetById(7);  
  15.             oListItem["Title"] = "Custom Title updated Programmatically.";  
  16.             oListItem.Update();  
  17.             clientContext.ExecuteQuery();   
  18.      
  19.               
  20.         }  
  21.     }  
  22. }   
Thanks for reading.