In this blog, we will see the steps involved in updating the date field in SharePoint list in Office 365, using CSOM.
- var login = "[email protected]";
- var password = "your password"
-
- var securePassword = new SecureString();
-
- foreach (char c in password)
- {
- securePassword.AppendChar(c);
- }
- SharePointOnlineCredentials onlineCredentials = new SharePointOnlineCredentials(login, securePassword);
-
- ClientContext context = new ClientContext(SiteURL);
- context.Credentials = onlineCredentials;
- List list = context.Web.Lists.GetByTitle("startupListList");
- ListItem oListItem = list.GetItemById(1);
-
- oListItem["StartupDate"] = DateTime.UtcNow;
-
- oListItem.Update();
-
- context.ExecuteQuery();
- }