I've created multiple custom reportsmultiple custom reports
for content managers. They all run as expected in the Sitecore Powershell ISESitecore Powershell ISE
.
When
When I save them in Reporting ToolsReporting Tools
and attempt to run, I am gettingget errors.
The
The first error was due to the relative -Path-Path
so I added the master:master:
prefix and that fixed it.
The
The error I'm stuck on is "Get-ItemTemplate : Current Sitecore database cannot be established, current location is not within a Sitecore content tree"
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
}