Platform SDK: Exchange 2000 Server |
[This is preliminary documentation and subject to change.]
Binds to and opens data from the existing item specified by URL.
[Visual Basic,VBScript] Sub Open( ByVal SourceURL as String, ByVal ActiveConnection as Object, [ByVal Mode as ConnectModeEnum], [ByVal CreateOptions as RecordCreateOptionsEnum], [ByVal Options as RecordOpenOptionsEnum], [ByVal UserName as String], [ByVal Password as String] ) [C++] HRESULT Open(BSTR SourceURL, IDispatch* ActiveConnection = 0, ConnectModeEnum Mode, RecordCreateOptionsEnum CreateOptions, RecordOpenOptionsEnum Options, BSTR UserName, BSTR Password ); [IDL] HRESULT Open( [in] BSTR SourceURL, [in, defaultvalue(0)] IDispatch* ActiveConnection, [in, optional] ConnectModeEnum Mode, [in, optional] RecordCreateOptionsEnum CreateOptions, [in, optional] RecordOpenOptionsEnum Options, [in, optional] BSTR UserName, [in, optional] BSTR Password );
The specified URL must identify a valid URL namespace that the OLE DB 2.5 root binder can resolve to a registered provider binder. Once resolved, the URL must conform to that provider binder's URL semantics.
The Open method has an identical signature to the Open method defined by ADO interfaces such as the _Record, _Recordset, and _Stream interfaces. The IDataSource.Open method, unlike the _Record.Open or _Stream.Open, cannot be used to create new items. Therefore, the CreateOption parameter must always be set to adFailIfNotExists. The other enumerated values and their semantic definitions are defined as part of the ADO type library and documentation. Consult the Microsoft® ActiveX® Data Objects (ADO) Version 2.5 documentation for a list of valid enumeration values and their intended purpose. Use of various enumerated values and their intended meaning is specific to a particular OLE DB 2.5 provider.
Restrictions on what types of data can be opened and how that data is handled by an implementation of the IDataSource interface is not part of this definition. Consult the appropriate COM class reference for further information.
Dim iFldr As New Folder Dim iDsrc As CDO.IDataSource Set iDsrc = iFldr ' Open private root folder: ' e.g. URL1 = "file://./backofficestorage/microsoft.com/MBX2/useralias/" iDsrc.Open URL1, , adModeReadWrite Dim Conn As ADODB.Connection Set Conn = iDsrc.ActiveConnection Dim iMsg As New CDO.Message Set iDsrc = iMsg iDsrc.Open "MySavedItems/item8.eml", _ Conn, _ adModeReadWrite
/* Assume these headers: * * #import <msado15.dll> no_namespace * #import <cdoex.dll> no_namespace * #include <iostream.h> */ IDataSource* pDsrc = NULL; HRESULT hr = CoCreateInstance(__uuidof(Item), NULL, CLSCTX_INPROC_SERVER, __uuidof(IDataSource), reinterpret_cast<void**>(&pDsrc)); // for passing optional variants, we may need this _variant_t varOpt(DISP_E_PARAMNOTFOUND,VT_ERROR); /* * Bind to web store root folder (private/messages) * e.g. URL1 below is something like * "file://./backofficestorage/microsoft.com/MBX/username/" * or "http://servername/exchange/username/" */ hr=pDsrc->raw_Open( url, NULL, adModeRead, adFailIfNotExists, adOpenSource, NULL, NULL ); if(FAILED(hr)) { cerr << "Error opening " << _bstr_t(url) << endl; pDsrc->Release(); return hr; } return pDsrc->QueryInterface(__uuidof(IItem),reinterpret_cast<void**>(ppItem)); }
Const adModeRead = 1 Const adModeReadWrite = 3 Const adCreateOverwrite = 67108864 Dim iFldr Set iFldr = CreateObject("CDO.Folder") Dim iDsrc Set iDsrc = iFldr ' Open private root folder: ' e.g. URL1 = "file://./backofficestorage/microsoft.com/MBX2/useralias/" iDsrc.Open URL1, , adModeReadWrite Dim Conn As ADODB.Connection Set Conn = iDsrc.ActiveConnection Dim iMsg As New CDO.Message Set iDsrc = iMsg iDsrc.Open "MySavedItems/item8.eml", _ Conn, _ adModeReadWrite