Skip to content

Instantly share code, notes, and snippets.

@BillCacy
Created June 9, 2016 19:03
Show Gist options
  • Save BillCacy/f61dd19d69c2c04689f081ceeea5a3c6 to your computer and use it in GitHub Desktop.
Save BillCacy/f61dd19d69c2c04689f081ceeea5a3c6 to your computer and use it in GitHub Desktop.
Sitecore Powershell - Update field values in all rich text items
$root = gi master:// -id "{0C3015B8-77AD-44DC-9633-2AD76489483A}"
$items = $root | ls -r | %{$item = $_; $_.Fields | ?{$_.TypeKey -eq "rich text"} }
#$items.Count
foreach($i in $items){
if($temp){
clear-variable("temp")
}
if($replaced){
clear-variable("replaced")
}
$replaced = $i.Value -replace 'https://randomlink.com', 'https://newlink.com'
$temp = $i.Item
$temp.Editing.BeginEdit()
$temp.Fields[$i.Name].Value = $replaced
$temp.Editing.EndEdit()
}
@float34
Copy link

float34 commented Dec 13, 2017

Thank you, it was helpful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment