I have seen examples out there where using CSOM you can do something like:
User usr = ctx.Web.SiteUsers.GetByEmail("person@domain.com"); ctx.Load(usr); ctx.ExecuteQuery(); Folder fldr = ctx.Web.GetFolderByServerRelativeUrl("/sitecollectionroot/subsite/Shared%20Documents/testfldr"); File file = fldr.Files.GetByUrl("testThumbnail.png"); List list = ctx.Web.Lists.GetByTitle("Documents"); ListItem item = file.ListItemAllFields; ctx.Load(list); ctx.Load(fldr); ctx.Load(file); ctx.Load(item); ctx.ExecuteQuery(); FieldUserValue newUser = new FieldUserValue(); newUser.LookupId = usr.Id; itemById["Editor"] = newUser; itemById.Update(); ctx.ExecuteQuery();
I tried this and it screwed up the farm in that in any site collection I had, the modified by field retained the Author value no matter who it was that was changing the item or document. Microsoft premier support said that this was due to some problem they were trying to patch--that it had to do with some checkin/checkout issue. I don't really understand why that would be, and if someone here that knows about this issue would like to chime in feel free.
Bottom line, that seems like a disaster. If I can issue a command like the above in CSOM and wipe out the ability for multiple site collections on my tenant to be able to retain proper capture of who was last editing a document there is a big problem.
Anyway, on to the real question. I want to know how I am really suppose to change these values. Obviously companies like AvePoint and ShareGate are retaining the versioning and author etc. info when moving stuff between site collections.
They are not using server side code or server side custom stuff they have built. So how are they doing this?
I have also seen examples of altering the list schema temporarily to set these above fields to readonly=false and then setting them back after all changes have been applied. IS this how third party vendors are doing this? It seemed that was a sorta work around.
Third I had heard some word that Microsoft was working on a tool or api component to be able to do this effectively? Is there a timeline on this?
Thanks.