1

I'm trying to find all items in Sitecore where a particular field ("ShortTitle") is blank. I have the following call working to Sitecore Powershell Extensions's (SPE) Find-Item, but there doesn't seem to be a way to negate the criteria filter. I don't want result where the field is empty--I want everything else, like "NotContains". Is there any way to do that?

Find-Item `
  -Index sitecore_web_index `
  -Criteria  @{Filter = "Contains"; Field = "ShortTitle"; Value = ""}     |
  Initialize-Item |
  Show-ListView @props -Property @{Label="Name"; Expression={$_.DisplayName} },
                                 @{Label="Short Title"; Expression={$_."ShortTitle"} },
                                 @{Label="Path"; Expression={$_.ItemPath} }
3

Although it's not mentioned in the official documentation, this feature has existed for some time with the Invert flag:

Find-Item -Index sitecore_web_index `
          -Criteria  @{Filter = "Contains"; Field = "ShortTitle";
                       Value = ""; Invert=$true} |
  Initialize-Item |
  Show-ListView -Property @{Label="Name"; Expression={$_.DisplayName} },
                          @{Label="Short Title"; Expression={$_."ShortTitle"} },
                          @{Label="Path"; Expression={$_.ItemPath} }

See this issue on GitHub. The issues on SPE's repo are a great source of information.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.