Its most common we need to update few column values in backed without changing system columns like Modified By, Modified On in a Sharepoint list / document library.
In order to achieve this, we need to go with Item.SystemUpdate() instead of Item.Update() in your C# code.
In case, if its a one time activity and we need to update data in bulk, the easiest way is to go with PowerShell script. Below is the example to update a column value in a list without changing Modified On and Modified By values, using PowerShell.
In order to achieve this, we need to go with Item.SystemUpdate() instead of Item.Update() in your C# code.
In case, if its a one time activity and we need to update data in bulk, the easiest way is to go with PowerShell script. Below is the example to update a column value in a list without changing Modified On and Modified By values, using PowerShell.
Add-PSSnapin microsoft.sharepoint.powershell
$web = Get-SPWeb "<<Site URL>>"
$list = $web.lists["<<List Name>>"]
#Get all items in particular list and save them to a variable.
#Here you can also apply your CAML query to fetch particular set of records
$items = $list.items
#Go through all list items
foreach($item in $items)
{
#If any conditions are required, can set them here in if clause.
#Update the fields as below.
$item["<<Field Display Name>>"] = "<<Value>>";
#This is the important change, using systemupdate will just set the above fields.
#This will not update Modified & Modified By Fields.
$item.SystemUpdate();
}
$web.Dispose();
No comments:
Post a Comment