Recently I had to work on an issue where a user needed to migrate a list from one site collection to another in a different site collection. He used CSOM for this but was challenged by the fact that the list also contained several people and group columns which cannot just be copied over to the new site collection, as the users will have different lookup ids in each site collection.
It took me a couple of minutes to assemble the necessary lines of code which I would like to share with you as well in case you have a need to do something similar.
The code below has been simplified and copies only one people and group column to describe the concept. For a real world scenario you might want to add code enumerate the columns to copy all columns in the list.
Very nice. Thank you, Stefan!
Super article. Thank you very much. I actually was encountering this issue. THANK YOU VERY MUCH.