Platform SDK: Exchange 2000 Server |
[This is preliminary documentation and subject to change.]
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);
This property returns the IDataSource interface on the object. Use the IDataSource interface exposed by the object to bind to items in a Microsoft Exchange public or private information store, a Web Store, or other objects, such as ADO Record or OLE DB Row objects. When binding to Record and Row objects, the underlying store item must be a container.
' Reference to Microsoft ActiveX Data Objects 2.5 Library ' Reference to Microsoft CDO for Exchange 2000 Library Function GetBoundFolder( Url as String ) As CDO.Folder Set Fldr = new Folder Set GetBoundFolder = Fldr.DataSource.Open(Url, , _ adModeReadWrite, _ adFailIfNotExists) End Function
'Const adModeReadWrite = 3 'Const adCreateCollection = 8192 'Const adCreateOverwrite = 67108864 Function GetBoundFolder( Url ) Set Fldr = CreateObject("CDO.Folder") Set GetBoundFolder = Fldr.DataSource.Open(Url, , _ adModeReadWrite, _ adFailIfNotExists) End Function
HRESULT CreateFolder(BSTR Url, BSTR contentclass, BSTR Description, IFolder** ppFldr) { /* Assume these headers: * * #import <msado15.dll> no_namespace * #import <cdoex.dll> no_namespace * */ if(ppFldr == NULL) return E_POINTER; IDataSource* pDsrc = NULL; HRESULT hr = CoCreateInstance( __uuidof(Folder), NULL, CLSCTX_INPROC_SERVER, __uuidof(IFolder), reinterpret_cast<void**>(ppFldr)); if(FAILED(hr)) return hr; hr = (*ppFldr)->put_ContentClass(contentclass); hr = (*ppFldr)->put_Description(Description); if(FAILED(hr)) { (*ppFldr)->Release(); *ppFldr = NULL; return E_UNEXPECTED; } hr = (*ppFldr)->QueryInterface( __uuidof(IDataSource), reinterpret_cast<void**>(&pDsrc)); if(FAILED(hr)) { (*ppFldr)->Release(); *ppFldr = NULL; return E_UNEXPECTED; } hr = pDsrc->raw_SaveTo( Url, NULL, adModeReadWrite, (RecordCreateOptionsEnum) ( adCreateCollection | adCreateOverwrite ), adOpenSource, NULL, NULL); if(FAILED(hr)) { (*ppFldr)->Release(); *ppFldr = NULL; } pDsrc->Release(); pDsrc = NULL; return hr; }