473,851 Members | 2,200 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

saving Oulook.MailItem objects

hello everyone.

My problem is as follows :

my application keeps a hashtable with Outlook.MailIte m 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.MailIte m 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.MailIte m object)
I'm stuck with this problem for almost 3 days without any lead ... PLEASE
HELP !!!

Thanks alot
Inon
Nov 13 '05 #1
1 6480
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************* *@exisconsultin g.com

"Inon Zukerman" <in*****@hotmai l.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
hello everyone.

My problem is as follows :

my application keeps a hashtable with Outlook.MailIte m 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.MailIte m 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.MailIte m object)
I'm stuck with this problem for almost 3 days without any lead ... PLEASE
HELP !!!

Thanks alot
Inon

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
7651
by: Karsten Schramm | last post by:
Hi, if I drag an Outlook.MailItem to a Windows-Explorer window a <subject>.msg file will be created. Now I try to drag & drop a mail item to my own WinForm app. Unfortunately it doesn't work. In the "drop event" are eight DataFormats (e.Data.GetFormats()) but the important one (imho) "FileContents" is "Nothing"/"null".
2
1587
by: Bora | last post by:
Is there a resource that discusses how C++ objects are saved to and loaded from files? Sorry if this is not a strictly C++ issue. In particular, I am looking for information about maintaining backwards compatibility of objects as they go through a series of changes such as adding or removing data members, etc. Thanks, Bora
0
328
by: Krishna | last post by:
I am trying to loop thru Inbox and select any one email and save it as a RTF file. Here is the code I am using Outlook.Explorer myOutlookExplorer = myOutlookApp.Explorers.Add(myOutlookNamespace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox), Outlook.OlFolderDisplayMode.olFolderDisplayNormal); myOutlookExplorer.Activate(); Outlook.MailItem myMailItem = (Outlook.MailItem) myOutlookExplorer.CurrentFolder.Items.Item(1);...
3
1174
by: Sidney | last post by:
How to make the system sending a job to MS Oulook by using VB.NET programming? thanks a lot~ Sidney
2
2153
by: Kannan | last post by:
Hi, I am trying to save Inbox selected message in C: I have used following code string SavedMessage = "C:\\AIA\\Message\\"; string strSaveName = "Test.msg"; Outlook._Application olApp = new Outlook.ApplicationClass(); Outlook._NameSpace olNs = olApp.GetNamespace("MAPI");Outlook.MAPIFolder oContacts = olApp.ActiveExplorer().CurrentFolder; Object selObject = olApp.ActiveExplorer().Selection;
1
1517
by: The Night Blogger | last post by:
Is there a way to pull & push data (Tasks, Notes, Calendar Items ...) into Microsoft Oulook from Python ?
0
895
by: Surmaj | last post by:
Hi I have a problem while saving the attachments of the outlook express mails in a local file. I am doing the following tasks. foreach (Object obj in inboxFolder.Items) { MailItem item = obj as MailItem ; ----
6
1575
mageswar005
by: mageswar005 | last post by:
Hi, Can anybody knows, How can i retrive oulook express mail using php.Its possible.please help me guys its urgent. Regards, M.Mageswaran
16
7264
by: Wayne | last post by:
I've read that one method of repairing a misbehaving database is to save all database objects as text and then rebuild them from the text files. I've used the following code posted by Lyle Fairfield to accomplish the first step: Private Sub SaveObjectsAsText() path = CurrentProject.path & "\ObjectsAsText\" SaveDataAccessPagesAsText SaveFormsAsText SaveReportsAsText
0
9898
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9748
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10735
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9506
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7907
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4549
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4143
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.