Find/Replace in SharePoint 2013 List Field
Post date: Apr 17, 2015 7:20:59 PM
I still need to create a function for this script, but I wanted to put this here so I don't loose it. Insert your site url, list name, field name (into two locations), the string to find, and the new string for replacement and execute.
$web = get-spweb -Identity "<<SITE_URL_WHERE_LIST_EXISTS>>"
$list = $web.lists["<<LIST_NAME>>"]
foreach ($item in $list.Items) {
# Iterate HyperLink fields
foreach ($field in $fields) {
# Get field value
$fldValue = $item["<<FIELD_NAME>>"]
# Skip if null
if($fldValue -ne $null) {
$item["<<FIELD_NAME>>"] = $fldValue -replace "<<STRING_TO_REPLACE>>", "<<NEW_STRING>>"
$item.update()
}
}
}