I'm trying to create a list item but the most basic formating is being removed from the input. Field type is Multiple lines of text and I've tried using Plain, Rick and Enhanced.
Script to create a list item and populate a field:
$List = $Context.Web.Lists.GetByTitle($listTitle)
$Context.Load($List)
$Context.ExecuteQuery()
$ListItemInfo = New-Object Microsoft.SharePoint.Client.ListItemCreationInformation
$ListItem = $List.AddItem($ListItemInfo)
$ListItem = $List.AddItem($ListItemInfo)
$ListItem["Title"] = $myVar.Title
$ListItem["BodyStuff"] = $myVar.SomeStuff
$ListItem.Update()
$Context.ExecuteQuery()
myVar.SomeStuff is populated with the following
Hello blah,
This is a test message.
Thank you, blahblah
some other random text
When the item is created in SharePoint, the value of myVar.SomeStuff is compressed together removing any line breaks or formatting.
BodyStuff will look like this:
Hello blah, This is a test message. Thank you, blahblah some other random text
\r\n
or<br>
characters as line breaks?PlainText
simple newlines (i.e.\r\n
) are used. For RichText and "Enhanced"html
is needed (i.e.<br>
)