I want to get all published pages to a specific publication target within a specific publication.
In Tridion 2013 SP1 there is this static method to do so: Tridion.ContentManager.Publishing.PublishEngine.GetPublishedItems()
However, GetPublishedItems() seems to always return page and component items. I could not find a way to filter on ItemType.Page.
Below is my attempt to filter on ItemType.Page, but the returned result contains both page and component items.
var filter = new Filter();
filter.Conditions["ItemType"] = ItemType.Page;
var publishedItemsFilter = new PublishedItemsFilter(filter, Engine.GetSession())
{
ForPublication = Publication,
PublicationTarget = ContextPublicationTarget,
IncludeTemplates = false
};
IEnumerable<IdentifiableObject> publishedItems = PublishEngine.GetPublishedItems(publishedItemsFilter);
The resulting publishedItems contains both pages and components. From here I do the filtering to get the published pages.
As you can see, this is not very efficient. In our case the code above takes +/-35 seconds to execute. We have a lot more published components than pages.
I believe I'm doing something incorrectly or missing something here.
Can someone please point out a correct or a more efficient way to get published pages?