Dela via


Source Property

Topic Last Modified: 2006-06-13

The reference to the currently bound object.

Applies To

IDataSource Interface

Type Library

Microsoft CDO for Exchange 2000 Library

DLL Implemented In

CDOEX.DLL

Syntax

Property Source As Object
HRESULT get_Source(IUnknown** pVal);

Parameters

  • pVal
    Returned reference to the IUnknown Interface of the object.

Remarks

There is a distinction between being bound to an object, and being bound to a item in a store such as Microsoft® Active Directory® or the Exchange store. This property returns the reference to a currently bound object. For example, if you previously bound a BodyPart object, the Source property would return the IUnknown interface on that object. However, if you are directly bound to an item in a store such as Active Directory or an Exchange store, the Source property returns nothing. You can check whether there is a currently bound object using the IDataSource.SourceClass property. If this property returns the empty string, there is not a currently bound object.

Interfaces exposed on the bound object may not be OLE Automation compatible, and the bound object may not expose the IDispatch interface. If you are developing an application using a mix of languages such as C++, Microsoft Visual Basic® and script, check the IDataSource.SourceClass property before attempting to use the Source property. You must make sure the bound object supports the necessary interfaces for the particular language. For example, an implementation of the IDataSource interface may support binding to an object exposing the IStream interface. Visual Basic applications cannot use this interface. Most likely, the object exposing IStream also does not expose the IDispatch interface, ruling out use by scripting languages altogether.

In C++, this property returns the IUnknown interface on the currently bound object. You can check the IDataSource.SourceClass to identify the name of the interface used to bind the object and may assume that this interface is supported. However, you must call QueryInterface to navigate to this interface on the object and you cannot assume that the returned reference can be statically "cast" to the interface type used to originally bind the object. This is especially important if the object on which you are invoking IDataSource methods resides in a separate Component Object Model (COM) compartment.