4

We have a Page with metadata for JS/XSLT/CSS and when the Page gets published, the underlying JS/XSLT/CSS too gets published. To publish the JS/XSLT/CSS, we are using engine.AddBinary().

We have an event extension that logs the published item information. When we publish the Page which we have described above, it is logging only the Page details and not the JS/XSLT/CSS details though they are getting published as part of Page publish.

We are using the code snippet as given below to get the processed items from the PublishTransaction object. If the Page has any Dynamic Components inside Page's Component Presentations, then those Dynamic Components are available under ProcessedItems object. However I am looking for CSS/JS/XSLT too in the list as they are getting published as part of the Page.

Example:

PublishTransaction transaction
IList<IdentifiableObject> items = transaction.Items;
foreach (IdentifiableObject item in items)
{
    IList<PublishContext> publishContexts = transaction.PublishContexts;
    foreach (PublishContext publishContext in publishContexts)
    {
        IList<ProcessedItem> oProcessedItems = publishContext.ProcessedItems;
        foreach (ProcessedItem oProcessedItem in oProcessedItems)
        {
            ....
        }
    }
}

Could you please help me in placing the correct API call to satisfy my requirement.

1

The ProcessedItems will contain items that are explicitly published, which is why you will find your Page there and also any Dynamic Component Presentation that is part of the Page, but not your Multimedia Components that are published via the AddBinary() call.

Frank van Puffelen has written a Binary Event Tracker and his extension adds two things for implicitly published binaries:

  1. Implicitly published binaries show up as published
  2. Binaries that are removed from the web server will show up as unpublished

For more details, read his entire description on SDL Tridion World, where you can also download the source code of his extension.

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.