1
Sitecoreのコンテンツツリーには、約3000件の記事のリストがあります。各記事には著者フィールドがあります。著者フィールドはタイプドロップリンクです。私は各著者が書いた記事の数を私に得させるPowerShellスクリプトを書こうとしています。Sitecore Powershellのドロップダウンフィールドによる検索/フィルタ
#This is where all the Authors lives
cd 'master:/sitecore/content/mysite/Global/Authors Folder'
#Get all the articles that each author has written
function ProcessItem($item)
{
$articles = Get-Item master: -Query "/sitecore/content/mySite/Home/Articles/2017//*[@@templatename='Article' and @Author='$item.Id']"
$articles.Count
}
#Get a list of authors
$itemsToProcess = Get-ChildItem -Recurse . | Where-Object { $_.TemplateName -match "Authors" }
if($itemsToProcess -ne $null)
{
$itemsToProcess | foreach {ProcessItem($_)}
}
投稿者IDで記事を取得する呼び出しが何も返されていないようです。したがって、$articles.Count
は常に0を返しています。私は@Author.Value='$item.Id'
にしようとしましたが、まだ結果が得られませんでした。私はここで間違っていることが誰でも見ることができますか?