Search code examples
c#lyncucma

Establish UserEndpoint without Credentials in UCMA 4


How can I establish a UserEndpoint without Credentials? I read somewhere that it should be possible if the Application/ApplicationServer is trusted by the Lync Server. This is the case, but it does not seem to work. I always get the Exception

No matching credential found for the realm.


Solution

  • Fist set-up CollaborationPlatform using ProvisionedApplicationPlatformSettings:

    ProvisionedApplicationPlatformSettings settings = new ProvisionedApplicationPlatformSettings("UCMA 4", _appID);
    CollaborationPlatform  _collabPlatform = new CollaborationPlatform(settings);
    _collabPlatform.RegisterForApplicationEndpointSettings(this.Platform_ApplicationEndpointOwnerDiscovered);
    // Initialize and start-up the platform.
    _collabPlatform.BeginStartup(EndPlatformStartup, _collabPlatform);
    

    Then Set-up your application endpoint in Platform_ApplicationEndpointOwnerDiscovered callback method. then once it all done you can call this method and set-up UserEndpoint without credentials:

    Use this method to create UserEndpoint
    private UserEndpoint CreateUserEndpoint(CollaborationPlatform  _collabPlatform, String _SIP)
    {
        try
        {
            UserEndpointSettings _settings = new UserEndpointSettings(_SIP, _serverFqdn);
            _settings.SupportedMimePartContentTypes = new ContentType[] { new ContentType("text/html"), new ContentType("text/plain") };
            _settings.AutomaticPresencePublicationEnabled = true;
            UserEndpoint _userEndpoint = new UserEndpoint(_collabPlatform, _settings);
            _userEndpoint.EndEstablish(_userEndpoint.BeginEstablish(null, null));
    
            return _userEndpoint;
        }
        catch (Exception exx)
        {
            Console.WriteLine("\n" + _SIP + "CreateUserEndpoint : " + exx);
            return null;
        }
    }