Using Tridion Core Service, how can I get all the items in a folder?
Asked
Active
Viewed 2,006 times
-2
-
2Please post the code you have tried - there are lots of Core Service examples here on SO already – Chris Summers Jul 13 '12 at 20:08
2 Answers
14
You need a filter (OrganizationalItemItemsFilterData).
Then you need to call client.GetList(folderId, filter) to get the list of items in that folder.
OrganizationalItemItemsFilterData filter = new OrganizationalItemItemsFilterData();
foreach (XElement element in client.GetListXml("tcm:3-640-2", filter).Nodes())
{
Console.WriteLine(element.Attribute("ID").Value);
}

Nuno Linhares
- 10,214
- 1
- 22
- 42
3
A good example on how to use the Core Service which contains all sorts of read operations (like reading a single item and getting a list of items) is shown in the following eXtension on SDL Tridion World: Item Selector Custom URL
The download on SDL Tridion World comes with complete source but this can also be found directly on Google Code where it is hosted as an open source solution. The actual Core Service code can be found in the UserControls/TridionTreeView.ascx.cs
Class.

Bart Koopman
- 4,835
- 17
- 30