Domanda

The scenario is I want to retrieve column values(Item Value) of the list from version history and update only single column of item post.

Currently, I am not able to retrieve item object values but I am able to get Created by the user, Title etc field values.

Can someone please help me with it.

Thanks in advance.

È stato utile?

Soluzione

I think you can achieve your scenario via Server-side Object Model C# to can update a column value in the Version history.

Code:

SPSite site = new SPSite("http://sharepointsite/subsite");
SPWeb web = site.OpenWeb();
SPList list = web.Lists["My List"];
web.AllowUnsafeUpdates = true;
foreach (SPListItem item in list.Items)
{
  item["Modified"] = "Set the date";
  item["Created"] = "Set the date";
  item["Editor"]="itemCreatedUser";
  item.UpdateOverwriteVersion();
}

Note :

It is impossible to update the Modified By values in the Version History. The data of version history is stored in the SQL database, but it is not recommended to edit the data in the database.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top