I am looking for a way to get list values from SharePoint 2007. Right now I am using PowerShell, and have the following script:
#load Microsoft.SharePoint.dll
[System.Reflection.Assembly]::LoadFrom("$12HivesDir\ISAPI\Microsoft.SharePoint.dll")
#returns the SPSite object from the specified URL
function get-spweb ([String]$webUrl=$(throw 'Parameter -webUrl is missing!'))
{
$site = New-Object -TypeName "Microsoft.SharePoint.SPSite" -ArgumentList "$webUrl";
return $site.OpenWeb();
}
$web = get-spweb http://myURL
$myList = $web.Lists["ListName"]
foreach($item in $myList.Items)
{
$item.Title
foreach($field in $item.Fields)
{
$field.Title
}
}
This script prints out the column headers, but I need to get the actual values. What is the best way to do it?
Thanks.