NicksonKoh
asked on
Powershell Script to extract metadata of records in document library
Hi Experts,
I am writing a powershell script to read the metadata of all records in document library in SharePoint 2007.
I am able to read the records but could not figure out how to read the values. Pls help.
rgds,
Nickson
I am writing a powershell script to read the metadata of all records in document library in SharePoint 2007.
I am able to read the records but could not figure out how to read the values. Pls help.
rgds,
Nickson
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thx Fox. The code looks great.
I tried and am getting the error at line 6
"$object | Add-Member -MemberType NoteProperty -Name 'Title' -Value $item["Name"]"
Cannot index into a null array.
At D:\Batch Jobs\PowerShell Scripts\Useful Scripts\List Value of Items in a List.ps1:11 char:78
+ $object | Add-Member -MemberType NoteProperty -Name 'Title' -Value $item[ <<<< "Name"]
+ CategoryInfo : InvalidOperation: (Name:String) [], RuntimeException
+ FullyQualifiedErrorId : NullArray
I tried and am getting the error at line 6
"$object | Add-Member -MemberType NoteProperty -Name 'Title' -Value $item["Name"]"
Cannot index into a null array.
At D:\Batch Jobs\PowerShell Scripts\Useful Scripts\List Value of Items in a List.ps1:11 char:78
+ $object | Add-Member -MemberType NoteProperty -Name 'Title' -Value $item[ <<<< "Name"]
+ CategoryInfo : InvalidOperation: (Name:String) [], RuntimeException
+ FullyQualifiedErrorId : NullArray
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Works Fantastic!
$web=Get-SPWeb http://
$list=$web.Lists["name of list"]
$list.Items | select Title, DisplayName
The select statement is where you select what columns you want to pull back. If you want them all, put "*"