Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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)
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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