Using the Core Service, is there any way to get information (ID at the minimum) about all the pages in the CMS?
I had tried recursing through structure groups but this takes hours as there are 50000+ pages. Currently I am getting this information by querying the database directly.
If there is a way would it be possible to do this for components, component templates etc?
For reference my recursion code is
static void Main(string[] args)
{
using (var client = new Tridion2011CoreService.CoreServiceClient())
{
var ids = GetIDsRecursive(client, "tcm:10-234567-4");
}
}
private static List<string> GetIDsRecursive(
Tridion2011CoreService.CoreServiceClient client,
string parentOrganisationalItemID,
IEnumerable<Tridion2011CoreService.ItemType> itemTypes)
{
var ids = new List<string>();
var filter = new Tridion2011CoreService.OrganizationalItemItemsFilterData();
var filterItemTypes = new List<Tridion2011CoreService.ItemType>();
if (parentOrganisationalItemID.EndsWith("-2"))
{
filterItemTypes.Add(Tridion2011CoreService.ItemType.Folder);
}
else
{
filterItemTypes.Add(Tridion2011CoreService.ItemType.StructureGroup);
}
filter.ItemTypes = filterItemTypes.ToArray();
var result1 = client.GetListXml(parentOrganisationalItemID, filter);
foreach (System.Xml.Linq.XElement node in result1.Nodes())
{
var id = node.Attribute("ID").Value;
ids.AddRange(GetIDsRecursive(client, id, itemTypes));
}
filter = new Tridion2011CoreService.OrganizationalItemItemsFilterData();
filter.ItemTypes = itemTypes.ToArray();
var result2 = client.GetListXml(parentOrganisationalItemID, filter);
foreach (System.Xml.Linq.XElement node in result2.Nodes())
{
var id = node.Attribute("ID").Value;
ids.Add(id);
}
return ids;
}