4

Chief Editor can publish item to different target at CMS portal. But inside our Alchemy4Tridion plugin, when call Tridion core service to load the target list based on current user permission, it will return nothing. If we change the permission to Administrator, then it can work.

List<TargetTypeData> targets = new List<TargetTypeData>();
var readoptions = new ReadOptions();
var filter = new TargetTypesFilterData();
var allPublicationTargets = client.GetSystemWideList(filter);
foreach (TargetTypeData pubTarget in allPublicationTargets)
{   
    targets.Add(pubTarget);
}
return targets;

Any idea why?

5

Publishing to a target is a different permission from actually loading those objects, as you are doing in your code. I am sure you could send something to publish to those targets using code - because that's controlled by the same permissions that control the UI.

To load the objects you need Admin rights indeed. You could use privilege elevation (available in Web 8) to allow this code to proceed.

In Core Service, use client.ElevatePrivileges(Privileges.ReadOnly) to perform this action (assuming read only is enough).

EDIT

Looking through the code here it seems that AlchemySessionAwareCoreServiceClient inherits directly from Tridion's SessionAwareCoreServiceClient - so this method should be available. Two things are possible:

  1. The Alchemy client you're using is still based on the 7.1 (2013 SP1) Core Service client or
  2. The method was changed between 8.1 and 8.5 (because I tested it on 8.5)

I strongly doubt #2, so my bet is on #1.

EDIT 2:

How are you instantiating your AlchemySessionAwareCoreServiceClient? You can tell it to use a Web 8 endpoint, see https://github.com/Alchemy4Tridion/Alchemy4Tridion/blob/master/Alchemy4Tridion.Plugins/Clients/AlchemySessionAwareCoreServiceClient.cs#L78

  • The AlchemySessionAwareCoreServiceClient class seems doesn't contain this method. Does it provide any other way to support this action? – qchen01 Feb 2 '17 at 16:26
  • See my 2 edits. – Nuno Linhares Feb 2 '17 at 17:28
  • You are right about Edit one, I still use version 7.1. As a first step, I will load 8.5 to see. Thanks very much for your help. – qchen01 Feb 2 '17 at 21:11
  • Any idea where we can find Tridion.ContentManager.CoreService.Client version 8.5? – qchen01 Feb 3 '17 at 15:32
  • Program files (x86)\sdl web\bin\client\coreservice – Nuno Linhares Feb 3 '17 at 16:20

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.