I have exported items using Export-Item command to a specific path in Data folder say, "websitepath/data/batch/userGivenName", please refer my previous question How to copy selected items to a Data folder using powershell script?
now I have to read the items from this folder. The items under folder are in .item extension.
I am able to get items using
$items = Get-ChildItem -Path "websitepath\Data\batch\sample"
, but the items are not deserialized.
I tried using, Import-Item but its returning empty list, how do I deserialize/convert them?
$items = Get-ChildItem -Path "websitepath\Data\buckets\sample"
$list=@();
$items|Foreach{
$itemPath="websitepath\Data\buckets\sample\"+$_.BaseName
$list+= Import-Item -Path $itemPath -Root "websitepath\Data\buckets\"
Write-Host($list)
}
if($list.Count -eq 0) {
Show-Alert "There are no items currently added to the batch."
}
else {
$list | Show-ListView
}
Close-Window
I referred following file for Import-Item, https://doc.sitecorepowershell.com/appendix/packaging/import-item-1
Any guidance would be helpful.