1

I have a CSV file where some of the values contain decoded HTML markups (e.g. <b%gt;Example</b%gt;) that I try to insert in a SharePoint list.

When I iterate through the values using PowerShell it splits up the strings at , no matter I do.
I have tried wrapping the strings with " and ' but then PowerShell throws this error:

update : Exception calling "Update" with "0" argument(s): "Invalid text value.

A text field contains invalid data. Please check the value and try again."

At C:\Scripts\Configuration\SystemConfiguration.ps1:41 char:22 + $spListItem.update <<<< () + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : DotNetMethodException

Here's an example on one of the values:

"&lt;b&gt;Dear {0} Team,&lt;/b&gt;&lt;br/&gt;{1} request was completed &lt;a href='{2}'&gt;{3}&lt;/a&gt;.&lt;br/&gt;&lt;br/&gt;{2}&lt;br/&gt;&lt;br/&gt;To download the PDF of the form please click &lt;a href='{6}'&gt;Here&lt;/a&gt;.&lt;br/&gt;In case of questions, please contact {4}.&lt;br/&gt;&lt;br/&gt;With best regards&lt;br/&gt;&lt;br/&gt;{5}" 

Can anyone provide me with some tips on how to ensure the above value can be successfully inserted?

    1 Answer 1

    1

    I found my answer by fooling around with some HttpUtility methods.

    $Value = &lt;b&gt;Dear {0} Team,&lt;/b&gt;&lt;br/&gt;{1} request was completed &lt;a href='{2}'&gt;{3}&lt;/a&gt;.&lt;br/&gt;&lt;br/&gt;{2}&lt;br/&gt;&lt;br/&gt;To download the PDF of the form please click &lt;a href='{6}'&gt;Here&lt;/a&gt;.&lt;br/&gt;In case of questions, please contact {4}.&lt;br/&gt;&lt;br/&gt;With best regards&lt;br/&gt;&lt;br/&gt;{5} [System.Web.HttpUtility]::HtmlDecode($Value)