0

I have the following structure in Sitecore 7 and I need to retrieve the descendants for those updated on 2011. How do I retrieve using fast query or PredicateBuilder?

Home
- Peek
  -2009
  -2010
    -Article 1 (updated on 2011)
    -Article 2
Home1
-Peek1
  -2010
  -2011
    -Article 3 (updated on 2011)

1 Answer 1

0

With Sitecore Fast Query you can use //* to get all descendants from a node. To get all desendants with an update date in 2011 you can use someting like this:

fast:/sitecore/content//*[@__Updated >= '20110101T000000' and @__Updated < '20120101T000000']

In Sitecore 7 you can use the XPath Builder in the Development center.

Note it is recommend to use the Sitecore Content Search API instead of a Sitecore Fast Query when you use it in code.

3
  • Hi , when I tried to use the above script, it will also return me the folder "2011" and the "Article 3" as the folder was with updated date on 2011. Is there anyway to retrieve just the descendant only? Meaning the last level.
    – snowfrost
    May 15, 2017 at 7:17
  • Perhaps, a solution is adding a template filter, If you know which template you want or which one not, use somethings like and @@templatename = 'Article ' May 15, 2017 at 10:52
  • Also it is possible to use a wildcard in the path try somethings like /sitecore/content/*/*/*/* to get all items from a specific level May 15, 2017 at 11:24

Your Answer

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

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