0% found this document useful (0 votes)
463 views2 pages

Sitecore Query Cheat Sheet

The document outlines common standard template fields and item attributes that can be used for querying items in Sitecore along with supported functions, axes, operators, prototypes, and APIs. It provides details on field names, data types, operators that can be used in queries, and examples of querying for items based on attributes like template ID, key, or field values. The red text in the document indicates that item or field names containing these values need to be escaped with hash characters when used in queries.

Uploaded by

xsamy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
463 views2 pages

Sitecore Query Cheat Sheet

The document outlines common standard template fields and item attributes that can be used for querying items in Sitecore along with supported functions, axes, operators, prototypes, and APIs. It provides details on field names, data types, operators that can be used in queries, and examples of querying for items based on attributes like template ID, key, or field values. The red text in the document indicates that item or field names containing these values need to be escaped with hash characters when used in queries.

Uploaded by

xsamy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Item Attributes Common Standard Template Fields

@@name Case sensitive @__Display name Display name


@@key ToLower(@@name) @__Updated Update date/time
@@templateid Template ID @__Updated by Case sensitive
username
@@templatename Case sensitive @__Created Creation date/time
@@templatekey ToLower(@@templatena @__Created by Case sensitive
me) username
@@id Item ID @__Lock Lock owner
@@masterid Branch template used @__Workflow state Workflow state ID
Supported Functions @__Publish Item publish date
contains('does this string', 'this string') @__Unpublish Item unpub. Date
startswith('does this string', 'this string') @__Valid to Version publish date
endswith('does this string', 'this string') @__Valid from Version unpublish date
not(condition) @__Never publish Prevent item
publication
position() @__Renderings Layout details
Axes
ancestor Ancestors of item
ancestor-or-self Item and its ancestors
child (/*) Children of item
descendant (//*) Descendants of item
descendant-or-self Item and its descendants
following Siblings sorted after item
parent Parent of item
preceding Siblings sorted before item
self (.) Item
[index] Position index: *[5] gets the fifth child
Operators
and And /*/content//*[@@templateid='<ID>' and
key='home']
or Or ../*[@@templateid='<ID>' or key='home']
xor Exclusive or Equivalent to and not()
| Catenation /*/content//*|/sitecore /media library//*
+ Addition
- Subtraction
* Multiplication
div Division
mod Modulus (remainder) /*/content//*[@IntField mod 2 = 1]
= Equal comparison
!= Not equal comparison
< Less than
<= Less than or equal to
> Greater than
>= Greater than or equal to
false Evaluates to false
true Evaluates to true Equivalent to not(false)
Prototypes
Item selected in field /*/content//*[contains(@ChecklistMultilistTreelistOrTreelistExField,
'<ItemID>']
Escape Item/Field Names /*/content//#item-name#[@#field-name#='value']
Date Comparison /*/content/*[@__Updated > 'yyyyMMddTHHmmss']
APIs
Sitecore.Data.Database SelectItems()
Sitecore.Data.Items.Item. SelectSingleItem()
Axes
Sitecore.Data.Query.Quer Execute()
y
Legend
Red text Escape with hash characters (#) when value appears in item name or field
name

You might also like