Exporting Outlook Mailboxes programmatically
-
Does anyone know if there is a way how to export emails from the Inbox/Outbox into .msg files programmatically? I tried using the Outlook Object Model, but it asks the user for permission to access the mailboxes and ideally I would like to avoid that (no, i'm *not* writing a virus... - i just would like to do away with user interaction while the program is running ). I also tried using MAPI, and i managed to read emails individually into the IMessage interface, but I can't see how I can stream its properties to a file without iterating on the properties one by one (and potentially risking modifying one property indadvertedly and ruining the entire message). My recent attempt has been with CDO but again, the MessagePtr interface in cdo.dll doesn't seem to support any streaming. Anyone has a better idea?
-
Does anyone know if there is a way how to export emails from the Inbox/Outbox into .msg files programmatically? I tried using the Outlook Object Model, but it asks the user for permission to access the mailboxes and ideally I would like to avoid that (no, i'm *not* writing a virus... - i just would like to do away with user interaction while the program is running ). I also tried using MAPI, and i managed to read emails individually into the IMessage interface, but I can't see how I can stream its properties to a file without iterating on the properties one by one (and potentially risking modifying one property indadvertedly and ruining the entire message). My recent attempt has been with CDO but again, the MessagePtr interface in cdo.dll doesn't seem to support any streaming. Anyone has a better idea?
Microsoft considers this a feature and provides no workaround: http://support.microsoft.com/default.aspx?scid=kb;en-us;821679&Product=ol2002M http://support.microsoft.com/kb/263074 Anything that uses outlook automation to retrieve email messages will have this restriction. -Matt ------------------------------------------ The 3 great virtues of a programmer: Laziness, Impatience, and Hubris. --Larry Wall