Hi All,
I need to retrieve the folder name for where the item is stored to generate a report in following format in csv
File Name Full Path Parent Folder Created By Last Modified By Number of Versions Total Size
My code which gets all other info.
function Get-DocInventory() {
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
$site=Get-SPSite -Identity "siteURL"
foreach ($web in $site.AllWebs) {
foreach ($list in $web.Lists) {
if ($list.BaseType -ne "DocumentLibrary") {continue}
foreach ($item in $list.Items) {
$data = @{
# "Web Application" = $webApp.ToString();
#"Web" = $web.Url"Site" = $site.Url"list" = $list.Title"Item ID" = $item.ID"Item URL" = $site.Url+"/"+$item.Url"Item Name"= $item.File.Name“Item Versions” = $item.Versions.Count
"Item Created" = $item["Created"]"Extensions" = $item.name.split(".")[1]"Item Modified" = $item["Modified"]"Item Created By" = $item["Author"]"Last Updated by" = $item["Editor"]"File Size" = $item.File.Length/1KB
}
New-Object PSObject -Property $data
}
}
$web.Dispose();
}
$site.Dispose()
}
#Get-DocInventory | Out-GridView
Get-DocInventory | Export-Csv -NoTypeInformation -Path D:\Scripts\Hemant\inventory.csv
Coukld you please help me get folder name
Thanks Basva









