Take the 2-minute tour ×
Tridion Stack Exchange is a question and answer site for Tridion developers and administrators. It's 100% free, no registration required.

I get the list of parent publications from child using the below snippet

var pubData = (PublicationData)client.Read("tcm:0-3702-1", new ReadOptions());
foreach (var parent in pubData.Parents)
{
    string parentUri = parent.IdRef;
}

Now I need to get the list of child publications from parent publication. Is there any way to obtain this?

share|improve this question

2 Answers 2

I think the solution you need is outlined here: http://stackoverflow.com/questions/9515647/getlistusingitems-with-tridion-core-service-returns-more-items-than-tom

Copied here to have the data within this website:

You should use BluePrintChainFilterData :

BluePrintChainFilterData filter = new BluePrintChainFilterData();
filter.Direction = BluePrintChainDirection.Down;
var result = ClientAdmin.GetListXml("tcm:3-1905", filter);

Please note that you can specify Direction property. This filter, however will not show you shared items. Also, try to avoid using UsingItemsFilterData as it is heavy on database

If you want to include shared items as well, then you can use BluePrintFilterData:

BluePrintFilterData filter = new BluePrintFilterData();
filter.ForItem = new LinkToRepositoryLocalObjectData{ IdRef = "tcm:3-1905"};
var listXml = ClientAdmin.GetSystemWideListXml(filter);
var list = ClientAdmin.GetSystemWideList(filter);

You can specify ForItem property here to set your item. It will return you something like this:

<tcm:ListBluePrintNodes Managed="1" xmlns:tcm="http://www.tridion.com/ContentManager/5.0" xmlns:xlink="http://www.w3.org/1999/xlink">
  <tcm:BluePrintNode ID="tcm:0-3-1" Title="Test" Icon="T1L0P0">
    <tcm:Item ID="tcm:3-1905" Title="Test multimedia component" ItemType="16" IsShared="False" IsLocalized="False" IsPublished="False" LockType="0" LockUser="tcm:0-0-0" Icon="T16L0P0Mgif"></tcm:Item>
  </tcm:BluePrintNode>
  <tcm:BluePrintNode ID="tcm:0-172-1" Title="test_child" Icon="T1L0P0">
    <tcm:Parents>
      <tcm:Parent xlink:href="tcm:0-3-1" xlink:title="Test" Priority="1"></tcm:Parent>
    </tcm:Parents>
    <tcm:Item ID="tcm:172-1905" Title="Test multimedia component" ItemType="16" IsShared="True" IsLocalized="False" IsPublished="False" LockType="0" LockUser="tcm:0-0-0" Icon="T16L0P0Mgif"></tcm:Item>
  </tcm:BluePrintNode>
</tcm:ListBluePrintNodes>

The good thing about system wide list is that you can use GetSystemWideList method that will return you array of BluePrintNodeData objects instead of XML

share|improve this answer
    
Hi John, I tried BluePrintChainFilterData earlier but this doesn't work on publications.it works on components,pages etc. –  Sam Mar 24 at 12:03
2  
Be smart. Each publication has a RootFolder property. Do it for root folders, it will give you pretty much the same result as there are no publications without folders. You can then get publications by looking at tcm:BluePrintNode attributes –  user978511 Mar 24 at 12:15
    
As you know all the root structure groups are inherited from the main parent and so all these are shared items.So if i try to get the list it gives me the complete publication list instead of just mentioning the exact blue print.Also if i try it on a localized root SG it returns only one node which is the current publication. –  Sam Mar 25 at 4:49

Well of course, the easy answer is that if you can get the parents, then listing the children is just a matter of programming.

As I recall, there isn't a particularly obvious way to get a list of children. You can perhaps use BluePrintNodesFilterData, but you'll still have some work to do.

It depends on what you are trying to do. I recall once trying to construct lists of children, only to discover that ICoreService2013.ResolveItems gave me a more direct route to my intended result.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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