How to update Date field in SharePoint list in sharepoint online using CSOM?

Hi SharePointers,

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

var login = “Lakshmanan@xxx.onmicrosoft.com”;
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();
}

Happy SharePointing Folks 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *