Platform SDK: Exchange 2000 Server

GetMessages Method

[This is preliminary documentation and subject to change.]

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);
DirName
The path to a directory that contains the messages. This parameter is optional, and if the empty string "" is specified, the currently defined SMTP drop directory is assumed.

Remarks

The collection returned by GetMessages 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 GetMessages again to retrieve a new collection.

Example

[Visual Basic]
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
[C++,IDL]
#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;
}
[VBScript]
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