5

SDL Web 8.5 integrated with Media Manager via the connector - we have two mount points configured and they appear fine in the GUI for the publication I'm working with - they have ids of mm02 and mm05 respectively and share the same privileged user and Everyone group for uploads.

In our TBB code we're making a call to _session.GetContententLibraryUris(publicationId) but this only returns one IEclUri object, for the mm02 mount point, I never get an object for the mm05 mount point.

I've checked the _session.TridionUser object and this is an administrator, basically the NT AUTHORITY\SYSTEM account.

Can anyone advise why I don't get both mount points returned - have I misunderstood what _session.GetContententLibraryUris(publicationId) does?

Stripped down code snippet (I'm using Error to log stuff - I know its crude!):

public class ResolveDistributions : TraceBaseTemplate
{
    private Engine _engine;
    private Package _package;

    public override void Transform(Engine engine, Package package)
    {
        _engine = engine;
        _package = package;

        var publicationId = _engine.PublishingContext.RenderedItem.ResolvedItem.Item.Id.PublicationId;

        using (_session = SessionFactory.CreateEclSession(_engine.GetSession()))
        {              
            _log.Error($"publicationId {publicationId}");

            var libs = _session.GetContententLibraryUris(publicationId);

            _log.Error($"libs {libs.Count}");
            foreach (var lib in libs)
            {
                _log.Error($"lib {lib.MountPointId} {lib.SubType} {lib.ItemId} {lib.IsNullUri}");
            }

            _log.Error($"User {_session.TridionUser.IsAdministrator} {_session.TridionUser.UserName} {_session.TridionUser.Id}");              
        }
    }       

    private IEclSession _session = null;
    private TemplatingLogger _log = TemplatingLogger.GetLogger(typeof(ResolveDistributions));
}

UPDATE

This system has a separate Publisher and CM servers - I've just noticed that the ExternalContentLibrary.xml has some differences between the two servers.

I assume these config files should be identical?

Cheers

  • How are you creating your ECL session? – Raimond May 8 '18 at 17:22
  • _session = SessionFactory.CreateEclSession(_engine.GetSession()) – Neil May 8 '18 at 19:41
  • Is _session a class variable? Are you sure it's not overwritten or anything? – Raimond May 9 '18 at 6:53
  • It is a class variable, but its initialised only once inside the Transform() method in a using statement and my debug code is called within a few lines of its initialisation. I've checked the entire TBB and I don't see this variable overwritten anywhere. What are you thinking Raimond! – Neil May 9 '18 at 7:12
  • Not much ;) You can convert the _session to a local var because of your using statement. The other thing I can think if is: maybe the machine you're rendering on doesnt have both mount points configured? Also - I would recommend to try this code by using a new Session with entering a named user in the constructor to ensure that is working at all. – Raimond May 9 '18 at 8:19
1

I can't come up with anything more than the obvious (the system you are testing on doesn't have the two mountpoints confifured or the user doesn't have access to both of them) and don't have a system with two mountpoints to validate it should work, but the API documentation seems to indicate it should.

I do think you should not be using that class variable for the ECL Session, it seems pointless, especially since you want it properly disposed at the end. So I would suggest to use the following and update your question in case it doesn't work (might be a bug or something):

// make sure eclSession is disposed at the end
using (IEclSession eclSession = SessionFactory.CreateEclSession(_engine.GetSession()))
{ 
    IList<IEclUri> mountpointUris = GetContententLibraryUris(publicationId);
    foreach (IEclUri eclUri in mountpointUris)
    {
        IContentLibraryContext mountpoint = eclSession.GetContentLibrary(eclUri);
    }
}
0

The issue was caused by differences between the ECL.xml file between the CM server and the Publisher server.

Once these were in sync, the method call returned consistent results.

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.