I am copying over items from one list to another list.
After copying the "Author" field gets populated with "System Account" and so I wish to update some fields in the destination list as follows.
I have a list with a custom Person column named "OriginalAuthor".
I want to replace the value of built-in "Author" with the value of "OriginalAuthor".
I also wish to achieve the same with the modified field (which currently DOES work)
I found a few examples on-line but could not get any to work. So far I have the following:
foreach (SPListItem destItem in destList.Items)
{
SPFieldUserValue val = new SPFieldUserValue(web.Site.RootWeb, destItem["OriginalAuthor"].ToString());
destItem["Author"] = val;
destItem["Modified"] = destItem["OriginalModified"];
destItem.Update();
}
destList.Update();
The modified date gets replaced however, the Author field remains the same.
How can I get this to work?
thanks, KS
destItem["Author"] = destItem["OriginalAuthor"]
, this doesn't work? if OriginalAuthor is Person field too, it should!