I've created multiple custom reports
for content managers. They all run as expected in the Sitecore Powershell ISE
.
When I save them in Reporting Tools
and attempt to run, I get errors.
The first error was due to the relative -Path
so I added the master:
prefix and that fixed it.
The error I'm stuck on is
Get-ItemTemplate : Current Sitecore database cannot be established, current location is not within a Sitecore content tree
Here is the relevant part of the report script. It fails on the last line:
$path = $root.Paths.FullPath
$pathtouse = "master:" + $path
#Get Items
$items = Get-ChildItem -Path $pathtouse -Recurse
#For each item check templates
foreach($item in $items){
$template = Get-ItemTemplate -ID $item.ID
}