0

I would like to generate report of all Tridion items (all publications) to analyze the content. Curious if I need to get the list of publications and iterate through all using core service, please suggest if anyone has done this and if there is any reference I can use.

  • Definitely a familiar topic, which starts with configuring your WCF client application, retrieving XML or data, and generating that report. It'll help to know about your environment and especially what step you need help with. Are you looking for an approach? Are you already familiar with WCF? Or are you looking to get a Publication, after having set up a client? – Alvin Reyes May 19 at 5:13
4

We've done this in many different guises and, as Jonathan notes, your mileage may vary depending on your access to the relevant resources (aka developers) and the actual requirement (mainly depending on the complexity of the ask, the output etc.).

For an ongoing engagement, I needed to assess the use of the content model. For this, one of my developers put together a PowerShell script (utilising Peter Kjaers excellent framework) that

  • listed all pages in a publication
  • list out various details of the page
  • iterate through CPs and list details of the CT and the Component
  • all pushed to CSV so I can produce a nice report in Excel.

This could have been achieved just as easily through the Core Service via a C# fragment but this was throwaway for me.

Things to watch for:

  • You likely want different approaches for local/localized/shared pages/CPs
  • Consider container Components - probably want to iterate through the Components contained etc.
| improve this answer | |
2

Getting a report using the CoreService has a relatively simple learning curve, though setting up that first client seems to be tricky.

I'll share examples and references for:

  1. Setting up a client environment
  2. Getting data
  3. Reporting (.csv, for example)

Client

Honestly, I preferred netTCP on the server because it seemed to "just work" and was simple enough to set up, but it depends on your access to the environment.

For a full overview, see the Documentation.

Otherwise: - Check out @puf's example on Stack Overflow. - See the specific Cookbook page for setting up a client (without an XML file). - Or see my BA Toolkit example based on the above.

For a proper setup, you probably want to read @EricHuiza's post on How to correctly dispose of a WCF client. Also note that by 2013 SP1, the product shipped with an already-created .NET client.

It's also a good idea to configure a secured connection.

Get Data

The "easy" part is getting the data. It's up to you on how to iterate on it.

I would recommend going Publication-by-Publication, recursively looking through folders, unless you're really looking for the relationships for each item (hint: Where Used is your friend). The hard part is what kind of data you want and format.

Calls would look something like:

foreach (XElement pubElement in bluePrintXml.Nodes())
   {
    var idAttribute = pubElement.Attribute("ID");
    if (idAttribute == null) continue; // I'm ignoring something but forgot why
    var publicationUri = idAttribute.Value;

    // DoStuff();

    pub++;
  consoleTracer.WriteLine(pubElement.Attribute("Title"));
  }

See my older BA Toolkit project for an example report to get authorization details using a console application. Pardon any hacks where I tried to figure out relationships using string manipulation. :-)

Report

Exporting your data to CSV seems popular enough for use in spreadsheets.

I found a nice CSV library from Black Belt Coder, though I'm sure there are other examples and projects for working with CSV.

Considering your version, I suspect you're working on an audit of some sort or perhaps upgrade. Consider a backup in case you're looking to also manipulate data and be sure to start and test with smaller sets of data, ideally on a test environment. Off-topic, but I'd recommend help if you need to get set up relatively quickly so you can focus on the requirements.

Finally, that UI is relatively fast at getting lists of data because it only retrieves and load IDs and titles in several places like the main list view. Getting all of the data in a folder will take more time, so be sure to either test and get smaller sets of data or up your configuration and time-outs.

But start with "Hello World" and go from there.

| improve this answer | |
1

It depends on what you mean by 'analyze' the content, really. For example, do you want to know the number of components of each type (i.e. based on each schema) or something more granular - For example, within specific fields within components?

If your Tridion search collection is up to date then you could use that (either within the 'Advanced Search' GUI or via script.

If you do need to use the Core Service then you can make a start by taking a look at the Core Service Recipes section with the Tridion Cookbook. The Examples Getting lists of items section of the Tridion documentation may also help you.

| improve this answer | |
1

I recommend using the core service from Powershell. For this, Peter Kjaer's module is very much the way to go. From Powershell writing to a spreadsheet is easy with Export-Csv

A lot of reports just involve brute-forcing your way through all or part of the data. For this, you can make use of the treewalk function which can be found at Tridion Practice. Because this technique uses individual reads of organizational items, it avoids some timeout problems that you might have with queries that return a lot of results. That said, it can take some time to run a big report.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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