0

I have a SharePoint list with a few rich text columns. I am recreating the list in a new site (for a number of reasons such as column names, etc) and am changing all rich text columns to just plain text. I am going to use powershell to copy list items from one list to another. However, when I copy the source rich text column to the target plain text column, all of the HTML markup comes across as well (and as expected). Is there a way in the powershell script strip off the html and just bring over the "text".

Current target column value with script:

-div- monthly report that is autogenerated and emailed -/div-

---- Note I replaced the <> characters on the div with - so the div appears in the text.

Wanted target column value with script:

monthly report that is autogenerated and emailed

2 Answers 2

1

You can mix this in your powershell script to strip off the html:

$string = <your rich text column>

$string -replace '<[^>]+>',''

1

I know this is an old question, but was looking for a similar thing and found the use of GetFieldValueAsText method:

$sourceField = $sourceItem.Fields['SourceFieldName'] -as [Microsoft.SharePoint.SPFieldMultiLineText] $targetItem['DestinationFieldName'] = $sourceField.GetFieldValueAsText($sourceItem['SourceFieldName']) 

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.