How To Update Date Field In SharePoint List In SharePoint Online Using CSOM

In this blog, we will see the steps involved in updating the date field in SharePoint list in Office 365, using CSOM. 

  1. var login = "[email protected]";  
  2. var password = "your password"  
  3.   
  4. var securePassword = new SecureString();  
  5.   
  6. foreach (char c in password)  
  7. {  
  8.    securePassword.AppendChar(c);  
  9. }  
  10.    SharePointOnlineCredentials onlineCredentials = new SharePointOnlineCredentials(login, securePassword);  
  11.   
  12.    ClientContext context = new ClientContext(SiteURL);  
  13.    context.Credentials = onlineCredentials;  
  14.    List list = context.Web.Lists.GetByTitle("startupListList");  
  15.    ListItem oListItem = list.GetItemById(1);  
  16.   
  17.    oListItem["StartupDate"] = DateTime.UtcNow;  
  18.   
  19.    oListItem.Update();  
  20.   
  21.    context.ExecuteQuery();