SharePoint List – Extract a MultiLine Text Field (HTML)

Ever wanted to extract a multiline text field from a SharePoint List.

And this in a fast way Smile


if((Get-PSSnapin | Where {$_.Name -eq "Microsoft.SharePoint.PowerShell"}) -eq $null)
    Add-PSSnapin Microsoft.SharePoint.PowerShell;

$WebURL = "http://YourSite/"

$listName = "YourList"

$ID = "1"
$TextField = "Your MultiLine Text Field Name"

#Get the Web & Lists using the SPQuery (fast way)
$Web = Get-SPWeb $WebURL

        #$WebUrl = $site.OpenWeb()
        $list = $web.Lists[$listName]

        $query = New-Object Microsoft.SharePoint.SPQuery

        $query.RowLimit = 100

        $query.Query = "<where><eq><fieldref name="ID" /><value type=" Number">"+$ID+"</value></eq></where>"

        $items = $list.GetItems($query)

            foreach($item in $items){

            Write-Host "ID = " $item.ID

            Write-Host "Activity ID : " $item.ID "-" $item.Title -nobr
            Write-Host ""

            Write-Host $Text

Notice the CAML query that grabs the record ID first. That will speed up the process tremendously.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: