By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,673 Members | 1,268 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,673 IT Pros & Developers. It's quick & easy.

saving Oulook.MailItem objects

P: n/a
hello everyone.

My problem is as follows :

my application keeps a hashtable with Outlook.MailItem objects.
I need to save and load this hashtable (with those objects inside) when
starting and terminating the
application.

I can't "serialize" them because Outlook.MailItem objects do not implement
the Iserializable interface.

so how do I go about saving and loading the hastable with the objects ??
(or even just tell me how to access the binary stream that compose each
Outlook.MailItem object)
I'm stuck with this problem for almost 3 days without any lead ... PLEASE
HELP !!!

Thanks alot
Inon
Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Inon,

The MailItem object is a COM object. You will want to import one of the
following interfaces into your application first:

IPersistFile
IPersistMemory
IPersistStream

These are COM interfaces that are used for persistence. If the MailItem
class implements one of these interfaces, then you can get the bytes from
the file, memory location, or stream (by calling Save on any of those
interface), and then store that byte array in your serialization stream
through custom serialization (create a wrapper for the MailItem class which
will serialize it correctly, exposing the MailItem through a property and
insert those into your hash table).

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Inon Zukerman" <in*****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
hello everyone.

My problem is as follows :

my application keeps a hashtable with Outlook.MailItem objects.
I need to save and load this hashtable (with those objects inside) when
starting and terminating the
application.

I can't "serialize" them because Outlook.MailItem objects do not implement
the Iserializable interface.

so how do I go about saving and loading the hastable with the objects ??
(or even just tell me how to access the binary stream that compose each
Outlook.MailItem object)
I'm stuck with this problem for almost 3 days without any lead ... PLEASE
HELP !!!

Thanks alot
Inon

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.