Im working on an application which is replicating files from one document library to another. Since it is a replication, I want the modified date to be preserved when I copy the file from the source library to the target, so that the user will see the real modified date in the target library and not the date of the replication run.
I access SharePoint through the client side object model and I have been able to set the modified date on a SharePoint 2010 on-premise using the following straght-forward code:
var listItem = list.GetItemById(id); context.Load(listItem); context.ExecuteQuery(); listItem["Modified"] = "03/11/1999"; listItem.Update(); context.ExecuteQuery();
Unfortunately when I execute the same code on any other SharePoint (2013 On-Premise, 2013 Online or 2010 Online) the code will execute without any errors, but the modified date will not be changed at all.
My actual question is: Is there any possibility to change the modified date throught CSOM on all of these SharePoint-versions?