How can I check if particular expected item is content and datasources
foreach($baseItem in $listOfPages) {
$items += Get-Item $baseItem.Paths.FullPath
$items += Get-ChildItem $baseItem.Paths.FullPath -Recurse
}
Sitecore Stack Exchange is a question and answer site for developers and end users of the Sitecore CMS and multichannel marketing software. It only takes a minute to sign up.
Sign up to join this communityHow can I check if particular expected item is content and datasources
foreach($baseItem in $listOfPages) {
$items += Get-Item $baseItem.Paths.FullPath
$items += Get-ChildItem $baseItem.Paths.FullPath -Recurse
}
It's hard to know what you mean by "is content and datasources".
You can call
$baseItem.Paths.IsContentItem
that will return true is descendant of /sitecore/content
item.
And you can
$baseItem.Template
$baseItem.TemplateID
$baseItem.TemplateName
values to get more information about what kind of item that is.
So you can check if the item is a Content
or Datasource
using this way also.
$renderingInstance = Get-Rendering -Item $baseItem -Rendering $rendering
if($renderingInstance)
{
Write-Host "content item"
}
else
{
Write-Host "datasource item"
}
You can implement this logic with your code. Hope this will help.