Tuesday 26 April 2016

SharePoint 2013 CSOM: Prevent last-modified and last-modified-by (or whatever they're called) from changing when updating programmatically.

Simply doing a
sharePointItem["Editor"] = sharePointItem["Editor"];
sharePointItem["Modified"] = sharePointItem["Modified"];
before the
sharePointItem.Update();
context.ExecuteQuery();
seemed to work for me on a Document Library.  

(I tried "Last_x0020_Modified" first which I got from a list of fields somewhere and that gives an error about..."not existing or might be read-only"?)

Also note that there appear to be other "modified"-type fields on a Document Library that might be for search, but I haven't felt the need to understand those.