Platform SDK: Exchange 2000 Server

GetInterface Method

[This is preliminary documentation and subject to change.]

Returns the specified dual interface on the object.

[Visual Basic]
Function GetInterface(ByVal Interface as String) as Object
[C++]
HRESULT GetInterface(BSTR Interface, IDispatch** pVal);
[IDL]
HRESULT GetInterface([in] BSTR Interface, [out,retval] IDispatch** pVal);
Interface
The name of the interface to obtain.

Remarks

The GetInterface method is primarily intended as a generic interface navigation aid to scripting languages that do not support such navigation directly. Most COM classes that provide implementations of the IMessage interface expose additional dual interfaces that are accessible by scripting languages only through properties on the interface, such as BodyPart and DataSource, or through the GetInterface method. When properties do not exist on the interface to return these interfaces, the GetInterface method must be used.

The list of valid interface names to pass to GetInterface is dependent upon a specific implementation. As a general rule, the name of the desired interface should match the physical name of the interface as it appears in the type library or idl file. Check the appropriate COM class for a list of exposed dual interfaces.

Example

The following examples demonstrate using GetInterface to return other interfaces on an ExchangeServer object.

VBScript

Dim iExchSvr
'Create an instance and get IExchangeServer (IDispatch) back
Set iExchSvr = CreateObject("CDOEXM.ExchangeServer")  

'Get IDataSource on the ExchangeServer Object
Set iDsrc = iExchSvr.GetInterface("IDataSource")

JScript

var iExchSvr = new ActiveXObject("CDOEXM.ExchangeServer");
var iDsrc = iExchSvr.GetInterface("IDataSource");