We need to convert all the rich text fields in a site collection to plain text field.
I am using the below powershell script to convert the rich text field to plain text field, however it is not working for enhanced rich text field
if ((Get-PSSnapin 'Microsoft.SharePoint.PowerShell' -ErrorAction SilentlyContinue) -eq $null) {
Add-PSSnapin 'Microsoft.SharePoint.PowerShell'
}
CLS
$spAssignment = Start-SPAssignment
# Get All Web Applications
$WebApps=Get-SPWebApplication https://<site>
foreach($webApp in $WebApps) {
# Get All Site Collections in the Web Application
Write-Host 'Web Application:' $($webApp.URL)
foreach ($spSite in $webApp.Sites) {
if($spSite.URL -eq 'https://<site>/Projects/RC1')
{
Write-Host 'Site Collection:' $($spSite.URL)
# Get the SubSites/Webs in the Site Collection
foreach($spWeb in $SPsite.AllWebs) {
# Get the the Lists in the Web
Write-Host 'SP Web URL' $($spweb.URL)
foreach($list in $spWeb.Lists) {
# Get the the Dcuments/List Items in the list
Write-Host 'List Title' $($list.Title)
foreach($field in $list.Fields)
{
if($field.RichText -eq $True)
{
$field.RichText = $False
#Set Field Type to 'Plain Text'
$field.RichTextMode = 'Compatible'
$field.Update()
Write-Host 'Field Type Updated Successfully!' $($field.Title)
}
if($field.RichTextMode -eq 'FullHtml')
{
$field.RichText = $False
#Set Field Type to 'Plain Text'
$field.RichTextMode = 'Compatible'
$field.Update()
Write-Host 'Field Type Updated Successfully!' $($field.Title)
}
}
}
}
}
}
}
Stop-SPAssignment $spAssignment
Below is the script output

No change in the list for the field that is enhanced rich text

Prabinesh