Skip to main content

Posts

Showing posts from January, 2016

Get all Items inheriting another template

Working on different templates and Sitecore items, its very common requirement to know

how many items are created with a specific templatehow many template are inheriting a base template or another template
Sitecore provide this feature out of box however you need to write query to fetch the required items.

Open Sitecore IDE (http://localhost/sitecore/shell/default.aspx?xmlcontrol=IDE)Goto Tools -> XPath BuilderWrite XPath Expression:
/sitecore/templates//*[contains(@__Base template,'{1FE1328B-375B-4548-A53E-344FA61ACC90}')]



In result section, it should show all templates which are inheriting base template with ID {1FE1328B-375B-4548-A53E-344FA61ACC90}.

Similarly, query  /sitecore/content//*[@@templatename='Promotional Page'] should show all pages (under content) created with 'Promotional Page' template.
On top of results, it shows the count of items and time taken to fetch the items.
We can use fast query as well instead of query.
Note: The above queries are …