This documentation is archived and is not being maintained.

Unified Communications Client API Coclasses

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Unified Communications Client API exposes a set of coclasses that show the relationship among a set of interfaces implemented by a particular coclass. When a client obtains a pointer to an interface belonging to a coclass, the client can obtain another interface in that coclass by calling the QueryInterface method on the given interface pointer. For example, the UccServerEndpoint coclass has the following Interface Description Language (IDL) definition:

coclass UccServerEndpoint
   [default] interface IUccEndpoint;
   interface IUccMediaEndpointSettings;
   interface IUccServerSignalingSettings;
   interface IUccSessionManager;
   interface IUccSubscriptionManager;
   interface IUccPublicationManager;
   interface IUccSignalingChannelManager;
   interface IUccConferenceManager;
   interface IUccDiagnosticReportingSettings;
   interface IUccUserSearchMananger;
   [default, source] dispinterface _IUccEndpointEvents;
   [source] dispinterface _IUccServerSignalingSettingsEvents;
   [source] dispinterface _IUccSessionManagerEvents;
   [source] dispinterface _IUccPublicationManagerEvents;
   [source] dispinterface _IUccMediaEndpointEvents;

As shown in the following C# code example, a client can obtain a pointer to the IUccServerSignalingSettings interface from a pointer to IUccEndpoint or any other interface implemented by this coclass.

IUccEndpoint endpoint = …;

IUccServerSignalingSettings settings = endpoint as IUccServerSignalingSettings;

In Unified Communications Client API, some coclasses can be co-created or instantiated. In a Win32 application, a co-creatable class can be created by calling the CoCreateInstance or CoCreateInstanceEx function. For a Win32 C++ code example, see Obtain an Interface Pointer Through a Co-creatable Co-class.

In a .NET application, this type of class is created by calling its constructor, for example:

UccContext ctx = new UccContext();

Some coclasses cannot be co-created. Attempts to instantiate a class that cannot be co-created generates the following compiler error:

"Error:The type 'Microsoft.Office.Interop.UccApi.<somecoclassname>' has no constructors defined"

A coclass can have an interface designated as the default interface. For a co-creatable coclass, the default interface is returned when the coclass is co-created or instantiated. The client can call the methods of the default interface on the coclass instance directly. The following method call is allowed because the Initialize method is defined on the IUccPlatform interface:

UccPlatform uccPlatform = new UccPlatform();

string appName = …;
UccContext ctx = …;
uccPlatform.Initialize(appName, ctx);

For a non-default interface, the client cannot call its methods until it obtains the interface explicitly. For example, IUccMediaDeviceManager is not a default interface on the UccPlatform coclass. To call the GetDevices method, the client must first obtain the IUccMediaDeviceManager interface pointer:

IUccMediaDeviceManager deviceMan = uccPlatform as IUccMediaDeviceManager;
deviceMan.GetDevices(mediaType, mediaDirections);
In the IDL definition, a method parameter can be of the type interface. If that interface is the default interface of only one coclass, that method parameter assumes the corresponding coclass type in the primary interoperable assembly. For example, in the IDL definition, the Initialize method takes two parameters: a string value and an IUccContext value. In the primary interoperable assembly (PIA), the second parameter becomes the UccContext type. This process occurs because IUccContext is the default interface of the UccContext coclass and is not part of any other coclasses.