Skip to main content

Posts

Showing posts from August, 2019

To update Created, Created By, Modified, Modified in SharePoint document library/list using Client Object Model -CSOM

The changes to the "Author" and "Editor" metadata are done under an user account with "site owner" privileges. That is the app pool's custom user account. <script type="text/javascript" src="https://code.jquery.com/jquery-1.10.2.min.js"></script> <script type="text/javascript"> // When the body is loaded, the onload event handler executes each function whose name is contained in this array. _spBodyOnLoadFunctionNames.push("callCSOM"); function callCSOM() {     $("#Button1").click(function()     {         // Make sure the SharePoint script file 'sp.js' is loaded before your code runs.         ExecuteOrDelayUntilScriptLoaded(updateUser, "sp.js");     });  } function updateUser() { var clientContext = new SP.ClientContext.get_current();   var web = clientContext.get_web();   var currentUser = web.ensureUser('User Name here');   clien...