Ersetzen Sie Zeilenumbrüche durch Leerzeichen, bevor Sie $ Description verwenden.
$web = get-spweb $siteUrl $caseLib = $web.lists | where {$_.title -eq $listTitle} $query=new-object Microsoft.SharePoint.SPQuery $query.ViewFields = "<FieldRef Name='LinkFilename'/><FieldRef Name='DocumentSetDescription'/>" $query.RowLimit=500000 Write-Output "Header}Description" | Out-File "temp.csv" do { $caseLibItems=$caseLib.GetItems($query) $query.ListItemCollectionPosition=$caseLibItems.ListItemCollectionPosition $listItemsTotal = $caseLibItems.Count $x = 0 for($x=0;$x -lt $listItemsTotal; $x++) { $Description = $caseLibItems[$x]["DocumentSetDescription"] $str = "" if('$Description' -ne $null) { ### Insert the line below to remove line breaks ############### $Description = $Description -replace "`n"," " -replace "`r"," " ############################################################### $str = $caseLibItems[$x]["LinkFilename"].ToString() + '}' + $Description } else { $str = $caseLibItems[$x]["LinkFilename"].ToString() } Write-Output $str | Out-File -Append "temp.csv" } } while ($query.ListItemCollectionPosition -ne $null) import-csv temp.csv -delimiter "}" | export-csv -NoTypeInformation -Path "result.csv" Write-Host "Exiting"
Antwort geteilt von Piero.