Created
June 9, 2016 19:03
-
-
Save BillCacy/f61dd19d69c2c04689f081ceeea5a3c6 to your computer and use it in GitHub Desktop.
Sitecore Powershell - Update field values in all rich text items
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you, it was helpful!