I would like get the closest list of items, if the items starts with particular name in the sitecore tree.

enter image description here

In the tree, if i am in Item page, i have to take all the closest items start with Item ItemDummy1
ItemDummy2 ItemDummy3 ItemDummy4

Do we have any fastest query to fetch the list?

  • Do you want to get the items based on the current item name? it would be good if you can explain it a little more. Jun 23, 2022 at 10:28

1 Answer 1


Sitecore query functions make it possible to perform Boolean operations with Items in query expressions and apply extra conditions to the query.

You can use startswith function:

   Function: startswith(s1:string,s2:string):bool

Description: Indicates whether s1 starts with substring s2. The comparison is case-sensitive.

Query Example:

query:/sitecore/content/home//*[startswith(@@name, 'Item')]

Returns child Items of the Home Item whose name starts with Item .

  • If the items are from the same template, you can also filter by template name or template id Jun 23, 2022 at 14:14
  • 5
    Traversing the entire content tree like this WILL lead to performance issues. I would not recommend following this approach, instead use the ContentSearch API to perform the query.
    – jammykam
    Jun 23, 2022 at 14:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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