I am designing an un-managed Win32 console application in VS2005 that will
be called from Windows 2000/3 Task Scheduler, the application will use
LPEXCHANGEMANAGESTORE (wow that's a long name), the application processes
mailboxes and public folder message stores and archives messages to an SQL
Server database. I will be using Exchange's MAPI32.DLL (not Outlook).
Is there any problem with wrapping LPMAPISESSION inside a singleton class
library, or simply keeping the MAPI session alive during a mailbox run. I
would like to do what MAPI likes the best. Here is an example of what a
mailbox run looks like. Here is some pseudo-code that describes the process.
1. Query Active Directory for List of Alias and ServerName (mailboxes to
3. OpenFirstMessageStore(Alias, ServerName).
4. Loop through all folders.
5. Update SQL DataBase with FolderHierarchy.
7. Update SQL DataBase with Messages & Attachments
9. Repeat the process, GOTO #2
There will usually be 50-100 mailboxes which will be archived, and so the
previous routine would Initialize and Uninitialize MAPI 50-100 times, once
each time for each mailbox.
I could Initialize MAPI once at the beginning and hang on to the
LPMAPISESSION during the entire run and then MAPIUninitialize().
What would MAPI like me to do?
Thanks for your advice.
Las Vegas, NV