Platform SDK: Exchange 2000 Server

DataSource Property

[This is preliminary documentation and subject to change.]

Returns the IDataSource interface on the object.

[Visual Basic,VBScript]
Property DataSource as IDataSource

read-only

[C++]
HRESULT get_DataSource(IDataSource** pVal);
[IDL]
HRESULT [propget] DataSource([out,retval] IDataSource** pVal);

Remarks

This property returns the IDataSource interface on the object. If the IDataSource interface is not implemented by the object, the COM exception E_NOTIMPL is raised.

This property is intended to provide a mechanism for interface navigation with scripting languages that do not natively support interface navigation. For programming languages such as C++, Microsoft® Visual Basic®, and Microsoft® Visual J++®, the preferred way to navigate to the IDataSource interface on an object is to use native mechanisms, namely QueryInterface, the Set keyword, or type casting respectively. However, the DataSource property is perfectly valid to use from these languages as well.

Example

[Visual Basic]
Dim iMsg as New CDO.Message

Dim iDSrc as CDO.IDataSource
Set iDSrc = iMsg ' the native way
Set iDSrc = Nothing
Set iDSrc = Bp.DataSource  ' this works as well
[C++,IDL]
#import "c:\program files\common files\system\ado\msado15.dll" no_namespace
#import "c:\exchsrvr\bin\cdoex.dll" no_namespace

int main() {
  CoInitialize(NULL);
  {
    IMessagePtr pMSg(__uuidof(Message));
    IDataSourcePtr pDsrc;
    pDSrc = pMsg->DataSource;
    // should use QI as shown below:
    // pDSrc = pMsg;
    //...
  }
  CoUninitialize();
  return 1;
}
[VBScript]
Dim iMsg
Dim iBp
Set iMsg = CreateObject("CDO.Message")
Dim iDSrc
' navigate to DataSource in VBScript
Set iDSrc = iBp.DataSource