4

I have core service functional code that gets all the published pages against a specific publishing target. But as part of web 8, the concept of publishing target has been eliminated. Now I want to get the list of published pages against a specific target type.

Please suggest the way forward.

Also, as content author published pages against a target type so please suggest if I want to list all the target types in a drop down, and then on request display the pages published against selected target types.

2

In web 8 there is a new concept introduced as “Purpose” to manage all the publishing target settings directly into the Topology Manager. So In web 8, instead of defining the Target Type / Publishing Target you can also define the Purpose which I think is more user-friendly and meaningful for a developer.

Here is the example for your first requirement -

var filter = new PublishedItemsFilterData();

filter.Purpose = "Staging";

var listXml = client.GetSystemWideListXml(filter);

But if you want to use the target type then I think below sample can help you to build your code -

            string publicationUri = "tcm:0-20-1";
            TargetTypesFilterData targetTypesFilter = new TargetTypesFilterData();
            IEnumerable<TargetTypeData> targetTypes = client.GetSystemWideList(targetTypesFilter).OfType<TargetTypeData>();
            ResolveInstructionData resolveInstruction = new ResolveInstructionData();
            IEnumerable<PublishContextData> publishContextDatas = client.ResolveItems(
                new string[]
                {
                publicationUri
                },
                resolveInstruction,
                targetTypes.Select(tt => tt.Id).ToArray(),
                new ReadOptions());

            IEnumerable< LinkToTargetTypeData> finaltargetData = publishContextDatas.Select(pc => pc.TargetType);

            foreach (LinkToTargetTypeData item in finaltargetData)
            {
                if (item.Title == "NameOfTheTargetType")
                {
                    var filter = new PublishedItemsFilterData();
                    filter.TargetType = item;
                    //filter.Purpose = "Stging";

                    var listXml = client.GetSystemWideList(filter);
                }
            }

I think it will help you to start.

  • This makes sense. But I think Target type is still applicable in web 8 topology manager. It has business processes that includes one or more target types. Target types corresponds to purposes in the topology manager. My functionality need is to list all the target types in a drop down, and then on request display the pages published against selected target types. Why I selected the target types because content author published against a target type. and it would be easy for them to recognize. Please suggest! – Rites Jul 12 '16 at 7:33
  • Hi Rites, I have updated the question and answer. Please check it – Sayantan Basu Jul 12 '16 at 8:35
  • Hi Rites,If your query is resolved by my suggestion, then please accept it as a answer. – Sayantan Basu Jul 13 '16 at 15:21

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.