Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
GetTridionPublishTargets
private List<TridionItem> GetPublishTargets(string publicationUri, SessionAwareCoreServiceClient client)
{
List<TridionItem> pubTargetList = new List<TridionItem>();
var pubTargets = client.GetSystemWideList(new PublicationTargetsFilterData());
foreach (PublicationTargetData pubTargetdata in pubTargets)
{
PublicationTargetData target = (PublicationTargetData)client.Read(pubTargetdata.Id, new ReadOptions());
LinkToPublicationData[] pubDataItems = target.Publications;
foreach (LinkToPublicationData publicationData in pubDataItems)
{
if (publicationData.IdRef == publicationUri)
{
pubTargetList.Add(new TridionItem()
{
Id = pubTargetdata.Id,
Name = pubTargetdata.Title
});
}
}
}
return pubTargetList;
}
public class TridionItem
{
public String Name { get; set; }
public String Id { get; set; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.