Friday, February 8, 2013

Powershell script to modify links in SharePoint 2010 list


#To change List Items with Hyperlinks
$webURL = "http://website URL/"
$listName = "VendorContracts"
$fieldName = "File Link"
$web = Get-SpWeb $webURL
$list = $web.Lists[$listName]

foreach ($item in $list.Items)
{
$url = $item[$fieldName]
write-host $url
$url = $url -replace "string to be replace" , "new string"
$item[$fieldName] = $url
$item.Update()
write-host $item[$fieldName]
}