I'm trying to loop all splistitem in a folder of a library. I can get my library and have folder but i'm not able to get the items inside the folder. When i display the listitem for folder, i've the number of folder at root library and inside folder not the splistitem in folder. Here is what i did.
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$url = "http://myspurl"
$SPWeb = Get-SPWeb $url
#retrieve list to update
$list = $SPWeb.Lists["myList"]
write-host $list.Title
#loop in lib
foreach($folder in $list.Folders)
{
if($folder.Name -eq "10002")
{
#this count return me always the number of folder at the root of library and inside folder. and not the splistitem inside folder
$folder.ListItems.Count
foreach($item in $folder.ListItems)
{
#write-host "TEST"
#$item = $file.Item
#write-host "item = "$item.Title
#$item.Url
}
}
}
When i'll have splistitem inside folder i've to move it in an other folder depending of a meta
Thanks for your help