With the reference to this thread: https://tridion.stackexchange.com/a/4597/1556
I am looking for a similar answer where I need to fetch a list of publishing purposes(BPT) instead of PublicationTargets.
Could someone please suggest me this?
Tridion Stack Exchange is a question and answer site for Tridion developers and administrators. It only takes a minute to sign up.
Sign up to join this communityWith the reference to this thread: https://tridion.stackexchange.com/a/4597/1556
I am looking for a similar answer where I need to fetch a list of publishing purposes(BPT) instead of PublicationTargets.
Could someone please suggest me this?
For Core Service, read the BPT from the Publication and then you can get to TargetTypes and their Purpose:
var pub = (PublicationData)client.Read("tcm:0-x-1", null);
var bpt = (BusinessProcessTypeData)client.Read(pub.BusinessProcessType.IdRef, null);
bpt.TargetTypes.Select(tt => tt.Purpose);
A Publication/Repository has a BusinessProcessType
property which tells you what the selected Business Process Type (BPT) is for that Publication/Repository (if any).
A Business Process Type contains a set of Target Types which each have a distinct Purpose.
So, if you are working with TOM.NET and want to get a list of publishing purposes for a given context Publication, your code could look like this:
contextPublication.BussinessProcessType?.TargetTypes.Select(tt => tt.Purpose);
BusinessProcessType
property (which is a Link containing the BPT ID), read the BPT and then obtain the Target Type purposes (the Target Types are part of the BPT).
Apr 13, 2021 at 10:14