I have a Document Library contains multiple Document Sets, each of the Document Sets contains Files.
Document Library ----> Document Set ----> Files
My objective is to query all File Name only across Document Sets.
here are my code:
function Get-SPItem{
$web = Get-SPWeb $webUrl
$documentsLib = $web.Lists[$libraryName]
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$query = New-Object Microsoft.SharePoint.SPQuery
#$viewFields = "<FieldRef Name='Title'/><FieldRef Name='Name'/>"
$query.Query = $camlQuery
$query.ViewAttributes = "Scope='Recursive'"
$queryResults = $documentsLib.GetItems($query)
foreach($item in $queryResults){
$filename = [io.path]::GetFileNameWithoutExtension($item.Name)
Write-Host $filename
}
}
Get-SPItem
The code above return both Document Set Name and Files Name, which going to be extra row and how can I eliminate Document Set Name?
Thank you in advanced :)