Sitecore Powershell Bulk replaces richtext field contents

Source: Internet
Author: User

Q: There are thousands of pages on the site, and there are thousands of pages with the same broken link, which needs to be replaced with the correct one. How can you do this quickly and efficiently?

A: First of all, we will certainly consider the way this action is implemented,

1, simple cumbersome manual one page modification

2, through the Writing program extension implementation

3. Sitecore PowerShell

Square One certainly is excluded undesirable, method two actually also can realize, but I think I want to consider the method three, before I have never contacted, through this demand also learn the PowerShell syntax.

The final implementation of the code is as follows:

function Getalllanguageversions ($item) {    Get-item $item. Providerpath-language "ZH-CN"} function Processitem ($item) {    $html = $item. fields["MyField"]. Value-replace "http://www.baidu.com", "http://www.cnblogs.com/wem520"        $item. Editing.beginedit ()        $item. fields["MyField"]. Value= $html        $item. Editing.endedit ()    } $itemsToProcess = Get-childitem-path "/sitecore/content/home" | foreach {getalllanguageversions ($_)}if ($itemsToProcess-ne $null) {    $itemsToProcess | foreach {Processitem ($_)}}

  

Sitecore Powershell Bulk replaces richtext field contents

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.