Which is the best way to copy item with person column to another site ? Situation: I have source site A and destination site B with the same structured custom list. I have to copy item from A to B. Problem is with field "Boss" - it's person field type. A and B are on the same SP farm, synchronized with the same AD database.
code (simplified, sourceItem is current processing item from A and destItem is newly created item in B):
string sBoss = sourceItem["Boss"].ToString(); SPFieldUserValue user = new SPFieldUserValue(sourceItem.Web, sBoss); SPUser userdest = contextdestination.web.EnsureUser(user.User.LoginName); destItem["Boss"] = userdest;
Everything goes ok, till I am iterating item with Boss value, who is no longer valid in AD. On destItem the value of Bossfield is wrong. On sourceItem field on all views is displayed correctly and have right url to person. No error is fired. Is there some way to handle it , or is my solution totally wrong and must be done other way ?