0

I'm using managed (C#) CSOM to migrate some lists between sites. The problem is, I cannot find way to read and update version history of a ListItem. For example, I have multiline field called Objective discussion. Sharepoint stores many versions of this field with author of change:

enter image description here

But when I use CSOM I only have access to latest version - and no author!

enter image description here

I am aware that using standard approach this is not possible, as answered here, but maybe some of us have any idea of workaround? For example, I know that ID field cannot be migrated, but StackExchange found a way to deal with it. Any idea/brainstorming appreciated!

Thanks!

  • Heh, just found out why Import/Export missed lookup field. Essentially I was importing list into new path, and it couldn't find the list, because it was available under different path. If you have any problem with Import/Export command, use -Verbose parameter. Guess I need to learn PowerShell more. – komsky Oct 11 '16 at 14:57
0

So I haven't found any answer to it, except it can't be done via CSOM.

But I have found workaround, and it goes like this: Why I want to use CSOM anyway? My goal was to transfer list content into new SharePoint site, and any other way to copy list, for example using Export/Import-SPWeb didn't include very important lookup field. Lookup field can be imported using CSOM, so my decision was based on that. But CSOM don't support versioning. So the workaround was to do the Export/Import using PowerShell first. This would include multiline field with versions, but missed lookup field. But then, afterwards I'm able to update only lookup field using CSOM, and still preserving versions imported as a first step. This is not the direct answer to question above, but might provide some solutions to people struggling with same problem.

PowerShell export command:

Export-SPWeb -Identity http://source-host -Path C:\export_list.cmp -ItemUrl /Lists/ListTitleForExport -IncludeVersions All

PowerShell import command:

Import-SPWeb -Identity http://target-host -Path C:\export_list.cmp -Force -Verbose -IncludeUserSecurity -ErrorAction Continue

Last advice - if, after importing using PowerShell, your lookup column is broken you will have to delete and create this column again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.