| Platform SDK: CDO for Windows 2000 |
The GetMessages method returns a collection containing the messages in the specified directory.
[Visual Basic] Function GetMessages([ByVal DirName as String]) as IMessages [C++] HRESULT GetMessages(BSTR DirName, IMessages** pVal); [IDL] HRESULT GetMessages([in, optional] BSTR DirName, [out,retval] IMessages** pVal);
The collection returned by the GetMessages method contains Message objects derived from the files present in the directory at the time the method was invoked. The collection does not automatically get updated when new messages arrive in the directory. To refresh the collection, call the GetMessages method again to retrieve a new collection.
' Reference to Microsoft ActiveX Data Objects 2.5 Library
' Reference to Microsoft CDO for Windows 2000 Library
Dim iDropDir as New CDO.DropDirectory
Dim iMsgs as CDO.IMessages
Set iMsgs = iDropDir.GetMessages("c:\Inetput\mailroot\Drop")
' you now have the collection of messages
' in the SMTP drop directory
...
Set iMsgs = iDropDir.GetMessages("c:\mymessages")
' you now have the collection of messages
' located in the directory c:\mymessages
#import "c:\program files\common files\system\ado\msado15.dll" no_namespace raw_interfaces_only
#import <cdosys.dll> no_namespace raw_interfaces_only
main() {
CoInitialize(NULL);
IDropDirectory* pDropDir = NULL;
IMessages* pMsgs = NULL;
CoCreateInstance(
__uuidof(DropDirectory),
NULL,
CLSCTX_INPROC_SERVER,
__uuidof(IDropDirectory),
(void**)pDropDir);
// get collection from SMTP drop directory
pDropDir->GetMessages(L"c:\\Inetput\\mailroot\\Drop",&pMsgs);
// ...
pMsgs->Release();
// get collection from specific directory
pDropDir->GetMessages(L"c:\\mymessages",&pMsgs);
// ...
pMsgs->Release();
pDropDir->Release();
CoUninitialize();
return 1;
}
Dim iDropDir
Set iDropDir = CreateObject("CDO.Configuration")
Dim iMsgs
Set iMsgs = iDropDir.GetMessages("c:\Inetpub\mailroot\Drop")
' you now have the collection of messages
' in the SMTP drop directory
...
Set iMsgs = iDropDir.GetMessages("c:\mymessages")
' you now have the collection of messages
' located in the directory c:\mymessages