Console icon indicating copy to clipboard operation
Console copied to clipboard

Extend `Find-Item` with most frequent criteria being accessible through accelerator parameters

Open AdamNaj opened this issue 3 months ago • 2 comments

In my last project I found myself needing the list of latest versions of items of certain template under a specific root. While I have a cmdlet in the project for this now, I thought that this would be a worthy addition to the OOTB Find-Item Cmdlet.

The possible usage of Find-Item - that can be substitute as a blazing-fast and easy to use version of Get-ChildItem:

Find-Item `
    -Template "Foundation/SxaExtensions/_ScaffoldingCorporateHomePage" `
    -LatestVersion `
    -Path master:\templates | Initialize-Item

You may also notice that the -Index Parameter is missing as it is now optional. If it is not specified it will attempt to use the sitecore_{drive}_index or if not available - fall-back to sitecore_master_index so the most common scenario requires less code.

Those parameters can be mixed with other criteria.

AdamNaj avatar Oct 22 '25 17:10 AdamNaj

Done

AdamNaj avatar Oct 22 '25 17:10 AdamNaj

@AdamNaj Found an issue where the _templates is not available by default for a vanilla Sitecore instance. Did you include a patch in your Sitecore instance to include this?

By default we should consider _template and Equals instead.

https://github.com/SitecorePowerShell/Console/commit/8b688c567ec01a48cbbd07e3739a8986569a0ed6#diff-266165f64c19e5da2097171eddff3df0e3acf10109c45bc949a0ba843f1a34cfR112-R114

michaellwest avatar Nov 29 '25 05:11 michaellwest