How to Read/Update Multiple lines of text Field Value in SharePoint using PowerShell?

PowerShell to Get Value from Multiple lines of text field:

To Read the value of the multiline text field in SharePoint using PowerShell, use this script:

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue 

#configuration parameters
$WebURL="https://portal.crescent.com/selfservice/"
$ListName="Service Requests"
$ItemID=2
$FieldName="Request Description"

#Get Web, List, Item and Field
$Web= Get-SPWeb $WebURL
$List= $Web.Lists[$ListName]
$Item = $List.GetItembyID($ItemID)

#Get the field
$Field = $Item.Fields.GetField($FieldName)

#Retrieve field value with all formats applied
#$Field.GetFieldValueAsHTML($Item[$FieldName])
$MultilineValue=$Item[$FieldName]

#Get Field value Text alone -Without Formatting
$MultilineTextVale=$Field.GetFieldValueAsText($Item[$FieldName])

Update Multiple lines of text value using PowerShell:

Here is another example for updating the Rich text field.

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue 

#configuration parameters
$WebURL="https://portal.crescent.com/selfservice/"
$ListName="Service Requests"
$ItemID=2
$FieldName="Request Description"

#Get Web, List, Item and Field
$Web= Get-SPWeb $WebURL
$List= $Web.Lists[$ListName]
$Item = $List.GetItembyID($ItemID)

#Update the field value
$Item[$FieldName]="Service Request No: 3435"
$Item.update()

#update HTML formatted value
#$Item[$FieldName]="Service Request No: <b> 3435</b>"
$Item.update()

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. Passionate about sharing the deep technical knowledge and experience to help others, through the real-world articles!

2 thoughts on “How to Read/Update Multiple lines of text Field Value in SharePoint using PowerShell?

  • This is CSOM, isn’t it?

    Reply
    • No! This is server object model and must be run from any server in the on-premises.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *