1

I have a link field and XML looks like the below. Using SessionAwareCoreServiceClient c#; I would like to get the page URL for "tcm:99-99999". "tcm:99-99999" is a component "Global EN\Building Blocks\Content\xyz" it seems. I am not sure how to get page links using the core service.

 <link xlink:type="simple" xlink:href="tcm:99-99999" xlink:title="TC Bakel - home" xmlns:xlink="http://www.w3.org/1999/xlink" />

I have tried like below but it is listing pages than what actual page

var filter = new UsingItemsFilterData
{
    ItemTypes = new[] { ItemType.Page },
    BaseColumns = ListBaseColumns.Extended
};

IEnumerable<PageData> usingPages = TridionServiceClient.Instance.GetClient().GetList(field.XlinkHref, filter).OfType<PageData>();
1
  • please update to tag the tridion sites version.
    – Velmurugan
    Apr 3 at 19:39

1 Answer 1

1

This below solution only applies to the Topology manager setup with the view on-site feature introduced in Tridion Sites 8.0+,

For the component possibly used directly or indirectly to resolve multiple pages, you need to use the ResolveContainingPages core service method to return a set of pages where the component is directly or indirectly (via component links) used.

If page is published, the associated set of publish info is also returned (one PublishInfoData instance per publish destination).

ContainingPagesDictionary ResolveContainingPages(
    string componentId,
    ResolveContainingPagesInstructionData instruction
)

Example:

 ResolveContainingPagesInstructionData instruction = new ResolveContainingPagesInstructionData() {
        IncludeComponentMetadataLinks = true,
        IncludeDynamicVersion = true,
        IncludePageMetadataLinks = true,
        IncludeWorkflow = true,
        ResolvePublishedPagesOnly = true
    };

    ContainingPagesDictionary dictionary = Client.ResolveContainingPages("tcm:1135-11570", instruction);
  
    foreach (var key in dictionary.Keys.OrderBy(k => k.Item.Title))
    {
        string publishUrl = Client.GetPublishUrl(key.Item.IdRef, "Staging");
        Console.WriteLine($"{key.Item.Title} ({key.Item.IdRef}) - {publishUrl}");
    }

Updated:

Tridion Sites 2013sp1 - it's already retired, I think you need to do this by recursively doing a 'Where used' on the Component until you get a list of Pages and then seeing whether they're published to get the page URLs.

3
  • ResolveContainingPages method is not present , I am using 7.1.0.1290 Tridion.ContentManager.CoreService.Client dll
    – FHN
    Apr 4 at 4:34
  • Ah, Tridion 2013SP1 is already retired still using it? I have updated my answer.
    – Velmurugan
    Apr 4 at 9:54
  • As the version number suggests... that's a 10 year old release :)
    – Nuno Linhares
    Apr 4 at 12:30

Your Answer

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

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