2

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} }

1 Answer 1

4

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.

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .