In one of our Compound Page Templates, we need to provide an overview of all pages in a certain Structure Group, and show links to these pages. We use Page properties Title and PublishPath for this. Example:

var sgFilter = new OrganizationalItemItemsFilter(engine.GetSession())
    ItemTypes = new List<ItemType> { ItemType.Page },
    Recursive = false,
StructureGroup sg = (StructureGroup)engine.GetObject(sgWebdavURL);
foreach (Page page in sg.GetItems(sgFilter))
    Logger.Debug("Page alphabet title = " + page.Title);
    Logger.Debug("Page alphabet publishpath = " + page.PublishPath);

Where sgWebdavURL is a string that is filled from the page metadata.

However, page.PublishPath is always NULL! I expected GetItems() to retrieve fully loaded Page objects. Appearently that is not the case. However, the LoadState Enumeration documentation suggests that a property, that has not been loaded yet, will be populated Just-In-Time when it is accessed.

Why does page.PublishPath return NULL? Why is the page object not fully loaded when the property is accessed? We use SDL Tridion 2011 SP1 HR 1.

This seems similar to https://stackoverflow.com/questions/13071526/accessing-properties-of-tom-net-objects-when-passing-them-between-methods-after

To work around this, I explicitly load the full Page object:

Logger.Debug("Page load state = " + page.LoadState.ToString());
if (page.LoadState != LoadState.FullyLoaded)

This is quite an expensive operation. However, in our case, the actual requirement is a bit more complex than shown in the example above. We only need the link to the index page (which has page title "index") so only for this one page, the Load() is executed.

This does not answer the question why the page object is not fully loaded automatically when the PublishPath property is accessed...


I think the point is that when evaluating a list like this, Tridion doesn't "know" whether you want to read off something that is available without accessing the object (e.g. the ID) or whether a page object needs to be instantiated.

If you need the publishPath, then the page will have to be instantiated, even if that's a relatively heavy operation. As to whether the API should automatically load the full page object on demand (when a property is accessed), I suppose that's a design decision that could have gone one way or the other. You can always propose it as an enhancement on ideas.

Have you considered using Page links instead?

  • Thanks Dominic, I had not thought about using Page links yet. The point is, we are doing a migration from VBscript templates to Compound templating, and we are (wrongly) using the "garbage in, garbage out" principle. I will refactor the code to use Page links instead.
    – Edwin Room
    Jun 19 '13 at 5:58

This doesn't seem right indeed, and I would expect - just as you - that PublishPath would never be null. I'd recommend sharing your findings with Customer Support.

However, to provide the functionality you're trying to achieve I would recommend using Page Linking instead of URLs. You could use a simple GetListItems() to get the list of IDs in a given structure group, then output page links with the TCDL syntax:

<tcdl:link type="Page" 

The documentation for tcdl:link is available in LiveContent (login required).


The only thing I can think for this is that PublishPath will get evaluated at the Deployment/Storage phase which is Configured in the Storage Config whereas the execution of your Compound Template would happen at the Rendering phase. Since the rendering phase will come before the deployment/storage phase, this information will not be available.

  • Thanks for you answer Pankaj, although I am not sure the PublishPath property is only available after deployment. It is just a concatenation of Publication publish path and Structure group directory properties. All that information should be available at Rendering phase.
    – Edwin Room
    Jun 19 '13 at 6:02

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.