4

We use Tridion 2011 serve the same site to 19 different country publications. We are upgrading to 2013 and need to be able to replicate what assets of all types are live in each given target + publication combination, and I'm trying to help with detective work on the matter. I am a front end developer who's just barely knowledgable enough to be dangerous in Tridion.

My assumption is that the way to do it would be:

  1. Create a custom page with a means to select a target and a publication. Given that all of these are known, I'm fine with the short term hardcoding of these in order to get the work done faster.
  2. On submitting the form, iterate through components and pages and inspect each one to see if it is published to the specified target.

I have no idea how to do any of that, but the ingredients seem to be scattered amongst several questions. It seems to me like #2 would be terribly expensive and take ages. So I would think that breaking it up into steps would be better, but can't think of a good way to do so.

Also, I would wonder if there is a simpler way to access what is published to a target by querying the target for items published to it rather than inspecting each individual item to see if it is published to the target.

All I really need (by my inexperienced thinking) is the CMS path to each asset and its tcm id, e.g. "US-WEB/Root/legal/doodad.aspx tcm:99-1234-64" or "US-WEB/Building Blocks/Content/PressReleases/superduper tcm:99-109876"

So, what's the best way to do this that won't bog down our system for ages and give us reliable results (bonus points if theres a way to do it that can be done safely by someone who probably shouldn't be doing it in the first place.)

Thanks in advance!

1
  • 1
    I don't get why upgrading to 2013 means you need to know what you've currently got published. Apr 11, 2014 at 11:43

2 Answers 2

2

Mr. Huiza has written an article explaining how to use the Tridion Search API to get the list of published items. (in 2013 this is Solr underwater)

This would be the fastest way and also return a list of the items with title and id properties.

Then you would need to get each item with client.ReadData if you wish to perform actions or get more data. This second part of the script would be where you might use more time.

2

As usual with Tridion, there's about 100 different ways to do this :) I'll start with a simpler one (but with dependencies on your environment) and then a more complex one that should work anywhere.

Note: for approach #1 to work you need to use the Tridion Content Database (aka Broker DB) on your delivery side, and ideally have all your 19 publications using this database for item metadata. If you don't use the Broker DB for metadata, then look at approach #2.

Approach #1: Create a JSP or ASPX page with the following logic in it:

  • Create a query object for all items of type 64 (Pages)
  • Execute that query and list the properties you need

Something along these lines:

ItemTypeCriteria pagesOnly = new ItemTypeCriteria(64);
Query q = new Query(CriteriaFactory.And(new Criteria[] { pagesOnly }));
string[] results = q.ExecuteQuery(); // will return string array of TCM IDs for all objects. May take a while.
content.InnerHtml = "<table border=\"1\"><tr><th>Page Title</th><th>Page URI</th><th>Page Path</th></tr>";
foreach (string id in results)
{
    TcmUri uri = new TcmUri(id);
    PageMetaFactory pmf = new PageMetaFactory(uri.PublicationId);

    IPageMeta pageMeta = pmf.GetMeta(id);
    string pageTitle = pageMeta.Title;
    string pagePath = pageMeta.Path;
    content.InnerHtml += string.Format("<tr><td>{0}</td><td>{1}</td><td>{2}</td></tr>", pageTitle, id, pagePath);
}
content.InnerHtml += "</table>";

My apologies for the crappy html :)

The other approach is to use CoreService and basically check individually for each page. In Tridion 2013 SP1 we introduced a PublishedItemsFilterData class which would allow you to get all items published to a target for a given publication with one call... but it's not available in 2011, so no luck.

2
  • HTML Tables are so 1990 ;) Apr 11, 2014 at 8:15
  • This is tabular data, so it's OK :p
    – Nuno Linhares
    Apr 11, 2014 at 11:13

Your Answer

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

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