Thursday, December 08, 2005

Getting folder items from Media Library


Applied to Sitecore V5.1.x. In order to get a list containing all the folder items in the media library and use it as a source for the Multilist field, you can use the following approaches:
  • query:/sitecore/media library//*[@@templatename='Media folder'] - Returns all items and all subitems based on the Media folder template. Note that the templatename attribute is case sensitive.
  • query:/sitecore/media library/*[@@templatename='Media folder'] - Returns all items under the root of Media library based on the Media folder template.
  • query:/sitecore/media library//*[@@templatekey='media folder'] - Returns all items and all subitems based on the Media folder template. Here is another approach using the templatekey attribute.
  • query:/sitecore/media library/*[@@templatekey='media folder'] - Returns all items under the root of Media library based on the Media folder template.
You may find this link useful as well: http://sdn5.sitecore.net/SDN5/FAQ/API/Lookups%20with%20XPath.aspx

0 comments: