I have a requirement to read each rich text field and then edit the content with unordered lists rather than ordered.


The easiest solution is probably to find and replace characters rather than parse all of the html. Try this:

# Home Item
$rootId = "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}"

# Get only the immediate children
$items = @((Get-ChildItem -Path "master:" -ID $rootId))
foreach($item in $items) {
    $html = $item.Text
    if([String]::IsNullOrEmpty($html)) { continue }
    $newText = $html.Replace("<ul>", "<ol>").Replace("</ul>", "</ol>")
    $item.Text = $newText

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.