I recently needed to read the text from a file in a SharePoint library using PowerShell. The only real challenge was converting the return ByteArray into a string. This might be a rare requirement, but just in case someone else might need it.
$site = Get-SPSite http://yourserver/sites/yoursite $web = $site.RootWeb $list = $web.Lists["Shared Documents"] $item = $list.Items $file = $item.File $data = $file.OpenBinary() $encode = New-Object System.Text.ASCIIEncoding $test = $encode.GetString($data)
Yes, it can be done in fewer steps… but for completeness…
For SharePoint 2007 replace the first line with these two:
$site = New-Object Microsoft.SharePoint.SPSite("http://yourserver/sites/yoursite")