Choose Skin

How To Replace all the values with new value in SharePoint 2010 List



Manish Kumar
Computer

In Sharepoint 2010 List, There may be a situation, where you have to replace all the values with new similar values in lists. For example, Let Suppose you have 10 columns, with 3000 items, and you have to change the values of a particular column with a new value, say "mkumar" in all the items.So, Its ver difficult to do it manually.

profile picture

To Counter this Problem, We have few Options, Here I am Going to replace all the values With the help of Powershell.

At First, Open Sharepoint Management Shell, Run it as Administrator.

    profile picture

Then Copy this code to Powershell :

$web = Get-SPWeb [Your sharepoint url]
$list = $web.Lists["Your List Name"]
$items = $list.Items
foreach ($item in $items) {$item["Column name you want to change"] = "Value you want";$item.Update()}
$web.Dispose()

For Example, in my case, the code is

$web = Get-SPWeb http://mkts-90
$list = $web.Lists["NavServiceLogReport"]
$items = $list.Items
foreach ($item in $items) {$item["Source"] = "xyz";$item.Update()}
$web.Dispose()

profile picture

Now, Refresh You site and Check the list data

Thanks,