0

We have total 4 Target types, Two are Marked Offline "Yes" and Two are Marked Offline "No". now we are getting all target types using below conde but we need available targets( offline "No") only. How to Get Active targets?

We are using SDL Tridion Sites 9.1

TargetTypesFilterData targetTypesFilter = new TargetTypesFilterData();
IEnumerable<TargetTypeData> targetTypes = _client.GetSystemWideList(targetTypesFilter)
.OfType<TargetTypeData>();

1 Answer 1

2

You would not be able to get the value of a Content Delivery environment's Marked Offline property using the Core Service API. You need to be using the Tridion.TopologyManager.Client DLL that allows communication with the Topology Manager items. You can find the DLL from the bin\client\TopologyManager subfolder of %TRIDON_HOME%.

To get the value Marked Offline property on Content Delivery environments, something like this should work:

TopologyManagerClient client = new TopologyManagerClient(new Uri("http://localhost:84/ttm201601/"));
client.CdTopologies
      .GetAllPages()
      .ToList()
      .ForEach(t =>
      {
         t.CdEnvironments.ToList().ForEach(e =>
         {
            if ((bool)e.IsOffline)
            {
                // The Marked Offline property is true.
            }
         });
      });
            

For more information on the Tridion.TopologyManager.Client endpoint, this TREX post should help: What is the Tridion.TopologyManager.Client endpoint.

Your Answer

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

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