I have an old method(mentioned below) for GUI extension which works fine in Tridion 2011 and 2013 where I am passing Publication Target and get all child Publications. But now when I deployed that code to WEB 8.5 it's not working. Also, I am getting an error

Exception message: Unable to cast object of type Tridion.ContentManager.CoreService.Client.TargetTypeData to type Tridion.ContentManager.CoreService.Client.PublicationTargetData

It seems like PublicationTargetData is eliminated and not supported for Web 8.5. Please help me out to get rid of this issue.

public Dictionary<string, string> GetValidChildPublicationList(string PublishingTargetUri)
    var client = _CoreServiceSession.GetClient();
    string publicationUri = GetCurrentPublicationIdFromObj();
    _childPublications = new Dictionary<string, string>();
    List<string> validPublications = new List<string>();

    ///Gets the list of Publications exisitng for current Publishing Target
    PublicationTargetData target = (PublicationTargetData)client.Read(PublishingTargetUri, new ReadOptions());

    foreach (LinkToPublicationData pub in target.Publications)

    ///Gets the child publications of the current item's publications
    UsingItemsFilterData usingPublicationsFilter = new UsingItemsFilterData
        BaseColumns = ListBaseColumns.IdAndTitle, // to specify the detail in the XML
        ItemTypes = new[] { ItemType.Publication },  // to specify certain items

    IEnumerable<XElement> usingPublicationXMLList = from comp in client.GetListXml(publicationUri, usingPublicationsFilter).Elements()
                                                    select comp;

    ///Add the current publication information to list of valid publications
    PublicationData currentPublication = (PublicationData)client.Read(publicationUri, new ReadOptions());
    if (validPublications.Contains(currentPublication.Id))
        _childPublications.Add(currentPublication.Id, currentPublication.Title);

    ///If the Publication is present in 
    foreach (XElement element in usingPublicationXMLList)
        if (validPublications.Contains(element.Attribute("ID").Value))
            _childPublications.Add(element.Attribute("ID").Value, element.Attribute("Title").Value);

    return _childPublications;
  • In Web 8, the old style publishing (Legacy Publishing) is updated to also include BusinessProcessTypes...and this changes some of the API methods around PublicationTargets and TargetTypes...I don't have a code sample handy, but looking into the BusinessProcessTypes should help...
    – robrtc
    Mar 22, 2019 at 14:24
  • Hi, I tried with business process types but unable to get list of publications based on Target Type.Could you please provide a sample example code to achieve this?
    – Biswas
    Mar 25, 2019 at 5:56

1 Answer 1


Publication Targets are deprecated since SDL Web 8; you don’t need them anymore if you are using Topology Manager based publishing.

However, they are still there for backwards compatibility purposes (even if you use Topology Manager based publishing).

So, your error is not caused by SDL Web 8.5 itself. Unfortunately, you didn’t provide much context for the error, but I guess it happens on the line where an item with a given URI (PublishingTargetUri) is read and then cast to PublicationTargetData.

I guess that the PublishingTargetUri is the TCM URI of a Target Type, resulting in this type cast exception.

So: the cause of this error probably lies in the caller of this method which provides a Target Type ID rather than a Publication Target ID (or in the method itself because it can’t deal with that; after all the term Publishing Target is used to denote a Publication Target or Target Type).


Based on the additional information you provided (in comments below), you confirmed that you are retrieving a Target Type ID and then provide it to this method which assumes it is a Publication Target ID.

I think what you were doing before is find Publications mapped to the same Publishing Target (before: Publication Target). With Topology Manager based publishing, those mappings are defined in Topology Manager rather than in Content Manager. For example, run Get-TtmMapping in PowerShell.

Although Publication Targets still exist for Topology Manager based publishing, they are not used for those mappings anymore. Note that the Topology Manager has a public API, though: Tridion.TopologyManager.Client.dll

  • No Rick as I am new to it, am asking for a sample code snippet( not the entire implementation)where I can get the publications based on Target Type since the old method throws the casting error.
    – Biswas
    Mar 25, 2019 at 5:53
  • Please provide more information; where are you obtaining the PublishingTargetUri from? Mar 25, 2019 at 7:38
  • Hi Rick, I am getting PublishingTargetUri from below method public Dictionary<string, string> GetPublishingTargets() { var client = _CoreServiceSession.GetClient(); Dictionary<string, string> publishingTargets = new Dictionary<string, string>(); var filter = new TargetTypesFilterData(); var allPublicationTargets = client.GetSystemWideList(filter); foreach (TargetTypeData pubTarget in allPublicationTargets) { publishingTargets.Add(pubTarget.Id, pubTarget.Title); } return publishingTargets; }
    – Biswas
    Mar 25, 2019 at 9:02
  • If I use PublicationTargetsFilterData and PublicationTargetData, i am not getting the targets in Web 8.5 hence i used the above method but it was working for 2013
    – Biswas
    Mar 25, 2019 at 9:04

Your Answer

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

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