Reputation: 2727
How would I get a list of Publication Targets with the Tridion Core Service? I see this code sample to get the Target Info, but cannot find a way to get the list from the Core Service. Maybe it is part of the Publication object?
var pubtarget = (PublicationTargetData)client.Read("tcm:0-21-65537", readoption);
Also, if there is a way to get this via the Anguilla JavaScript client it would also be cool.
Upvotes: 8
Views: 1143
Reputation: 4316
user978511 already answered how to do it using the Core Service, so let me just answer how you can do it using Anguilla:
var system = $models.getItem($const.TCMROOT);
var list = system.getListPublicationTargets();
From then on, it's a normal list -- so you'll want to check isLoaded()
and call load()
if it returns false
(hooking into the "load"/"loadfailed" events for the callback).
The Publication Targets are available either as XML through the getXml()
method or as an array through the getItems()
method (which returns an array of model items -- so again, you can check isLoaded()
on those, etc.)
Upvotes: 7
Reputation: 13483
var filter = new PublicationTargetsFilterData();
var pubTargets = ClientAdmin.GetSystemWideList(filter);
var pubTargetsXml = ClientAdmin.GetSystemWideListXml(filter);
You can set additional filter properties on filter
object
Upvotes: 8