Overview
Sometimes you need to run a quick report from Sitecore. For example - find all news published between 7/20/2017 and 7/24/2017. The easiest way to accomplish it is to use built-in XPath builder tool.
Step-by-Step Guide
- Login as admin and navigate to http://[YOUR-SITECORE-INSTANCE]/sitecore/shell/default.aspx?xmlcontrol=IDE.XPath.Builder
- Use Sitecore query to get content that you are looking for.
Note: Never run this on the live site before testing locally or on qa first. Certain queries may take a while to run and could cause significant performance issues.
Samples
Here are a few queries I’ve used:
- Get all news published between 08/07/2015 and 04/15/2016:
/sitecore/content/home/news//*[@__Created >= '20150807' and @__Created <= '20160415' and @@templateid = '{########-####-####-####-############}']
- Find all people created after 11/01/2016:
/sitecore/content/home/people//*[@@templateid = '{########-####-####-####-############}' AND @__Created>='20161101']
- Find all people with first name ‘John’:
/sitecore/content/home/people//*[@@templateid = '{########-####-####-####-############}' AND @FirstName='John']
- Find all fields with Field Fallback disabled:
/sitecore/templates/User Defined//*[@@templatename='Template field' and @Enable Shared Language Fallback!='1']
- Find all people whose last name contains ‘Co’:
/sitecore/content/home/people//*[@@templateid = '{########-####-####-####-############}' AND contains(@LastName, "Co")]