Discussion:
How to take a copy of incoming mail to Outlook?
(too old to reply)
Dkds.Naidu
2005-08-12 05:37:01 UTC
Permalink
Hi all,

I am developing ATL COM Addin for Microsoft Outlook. I am trying to
take backup of all incoming mails. I overridden OnDelivery method of
IExchExtSessionEvents interface. I can trap all incoming mails. But how can I
take a mail into backup and how to restore mails?

I am very new to this backup and restore mails. I know MAPI.

Can anybody suggest me?

Thanks in advance.




Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Dmitry Streblechenko
2005-08-12 05:42:00 UTC
Permalink
You mean you have an Exchange Client Extension, not a COM add-in, right?
What kind of backup do you have in mind? Outlook folder? DB? MSG file?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am trying to
take backup of all incoming mails. I overridden OnDelivery method of
IExchExtSessionEvents interface. I can trap all incoming mails. But how can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Dkds.Naidu
2005-08-12 05:53:01 UTC
Permalink
I love you Dmitry. Really you are giving lot of help.

Anyway, I have to take backup of all incoming mails and restore all mails
when user asks. this is very primary step of my project.


Thank you for giving immediate reply.

Thanks in advance.
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Post by Dmitry Streblechenko
You mean you have an Exchange Client Extension, not a COM add-in, right?
What kind of backup do you have in mind? Outlook folder? DB? MSG file?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am trying to
take backup of all incoming mails. I overridden OnDelivery method of
IExchExtSessionEvents interface. I can trap all incoming mails. But how can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Dmitry Streblechenko
2005-08-12 14:51:31 UTC
Permalink
What kind of backup? *Where* do you want to store the messages?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
I love you Dmitry. Really you are giving lot of help.
Anyway, I have to take backup of all incoming mails and restore all mails
when user asks. this is very primary step of my project.
Thank you for giving immediate reply.
Thanks in advance.
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Post by Dmitry Streblechenko
You mean you have an Exchange Client Extension, not a COM add-in, right?
What kind of backup do you have in mind? Outlook folder? DB? MSG file?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am trying to
take backup of all incoming mails. I overridden OnDelivery method of
IExchExtSessionEvents interface. I can trap all incoming mails. But how can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Dkds.Naidu
2005-08-16 06:04:02 UTC
Permalink
Hi Dmitry,


Thank you for your response.

Our company deals with INTERNET backup. We have 4 servers around the world.
I have to take backup of all incoming mails into our server. Then, restore
all backup mails when user asks to restore.

How can I solve this problem?

Plz post your comments.

My doubts are
1. How can I save incoming mails are save with .MSG file?
Note: I can get the all properties of all incoming mails. I overridden
OnDelivery method of IExchExtSessionEvents.

2. Can I restore mails programmatically if I save all mails with .MSG format?

Thanks in advance.

Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
What kind of backup? *Where* do you want to store the messages?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
I love you Dmitry. Really you are giving lot of help.
Anyway, I have to take backup of all incoming mails and restore all mails
when user asks. this is very primary step of my project.
Thank you for giving immediate reply.
Thanks in advance.
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Post by Dmitry Streblechenko
You mean you have an Exchange Client Extension, not a COM add-in, right?
What kind of backup do you have in mind? Outlook folder? DB? MSG file?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am trying to
take backup of all incoming mails. I overridden OnDelivery method of
IExchExtSessionEvents interface. I can trap all incoming mails. But how can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Dkds.Naidu
2005-08-16 06:51:19 UTC
Permalink
Hi Dmitry,

I am trying to design a utilty in Outlook where the user is
given the provision of saving a copy of the every incoming mail in a desired
location (currently in our server).

This utility will enable the user to resore/downlaod his mails
from the server once the user moves from his current place to a different
geographical location.

Currently am able to capture all the mails ( OnDelivery()
method of IExchExtSessionEvents) .How to save this mails in .MSG format with
UNICODE support?
I wonder whether am proceeding in the right direction in my quest to design
the above mentioned utilty!

My doubts are:

1. How can I save the incoming mail in .MSG format with UNICODE support.
Note: I can trap the incoming mail. How to save this mail with .msg format
and with unicode support.

2. Can I restore mails if I save mails in .msg with unicode support.


Seeking your guidance

Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
What kind of backup? *Where* do you want to store the messages?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
I love you Dmitry. Really you are giving lot of help.
Anyway, I have to take backup of all incoming mails and restore all mails
when user asks. this is very primary step of my project.
Thank you for giving immediate reply.
Thanks in advance.
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Post by Dmitry Streblechenko
You mean you have an Exchange Client Extension, not a COM add-in, right?
What kind of backup do you have in mind? Outlook folder? DB? MSG file?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am trying to
take backup of all incoming mails. I overridden OnDelivery method of
IExchExtSessionEvents interface. I can trap all incoming mails. But how can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Stephen Griffin
2005-08-16 14:06:24 UTC
Permalink
I would NOT use MSG as a means for message archiving/backup. This message
format is not suitable for storing all the variety of messages you will
encounter in the wild. In particular, deeply nested messages and messages
with large numbers of recipients and/or attachments will present unsolvable
problems with this format. Also, you lose a great deal in message fidelity
in conversion to and from this format.

You will be much better off developing your own format in which to archive
the messages, or (since it looks like this may be an in-house project),
locating a third party who has already done this work.

Steve
Post by Dkds.Naidu
Hi Dmitry,
I am trying to design a utilty in Outlook where the user is
given the provision of saving a copy of the every incoming mail in a desired
location (currently in our server).
This utility will enable the user to resore/downlaod his mails
from the server once the user moves from his current place to a different
geographical location.
Currently am able to capture all the mails ( OnDelivery()
method of IExchExtSessionEvents) .How to save this mails in .MSG format with
UNICODE support?
I wonder whether am proceeding in the right direction in my quest to design
the above mentioned utilty!
1. How can I save the incoming mail in .MSG format with UNICODE support.
Note: I can trap the incoming mail. How to save this mail with .msg format
and with unicode support.
2. Can I restore mails if I save mails in .msg with unicode support.
Seeking your guidance
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
What kind of backup? *Where* do you want to store the messages?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
I love you Dmitry. Really you are giving lot of help.
Anyway, I have to take backup of all incoming mails and restore all mails
when user asks. this is very primary step of my project.
Thank you for giving immediate reply.
Thanks in advance.
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Post by Dmitry Streblechenko
You mean you have an Exchange Client Extension, not a COM add-in, right?
What kind of backup do you have in mind? Outlook folder? DB? MSG file?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am trying to
take backup of all incoming mails. I overridden OnDelivery method of
IExchExtSessionEvents interface. I can trap all incoming mails. But
how
can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Dmitry Streblechenko
2005-08-16 16:48:08 UTC
Permalink
I have to disagree: you will have problems with any format. MIME might be a
good alternative, but it poses even greater conversion problems, especially
with the MAPI specific features, such as pure RTF messages, embedded OLE
attachments, etc.
You can of course develop your own format, but I suspect that it will take
you months to design and debug it to bring the number of bugs down to the
level that you will encounter with the MSG format.
The biggest MSG format problem is the messages with a large # of recipients,
but it easy to work around it by ussing StgCreateStorageEx (Windows 2000 and
up) rather than StgCreateDocfile.
Q171907 has sample code that shows how to save a message in the MSG format:
http://support.microsoft.com/?kbid=171907

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Stephen Griffin
I would NOT use MSG as a means for message archiving/backup. This message
format is not suitable for storing all the variety of messages you will
encounter in the wild. In particular, deeply nested messages and messages
with large numbers of recipients and/or attachments will present unsolvable
problems with this format. Also, you lose a great deal in message fidelity
in conversion to and from this format.
You will be much better off developing your own format in which to archive
the messages, or (since it looks like this may be an in-house project),
locating a third party who has already done this work.
Steve
Post by Dkds.Naidu
Hi Dmitry,
I am trying to design a utilty in Outlook where the user is
given the provision of saving a copy of the every incoming mail in a desired
location (currently in our server).
This utility will enable the user to resore/downlaod his mails
from the server once the user moves from his current place to a different
geographical location.
Currently am able to capture all the mails ( OnDelivery()
method of IExchExtSessionEvents) .How to save this mails in .MSG format with
UNICODE support?
I wonder whether am proceeding in the right direction in my quest to design
the above mentioned utilty!
1. How can I save the incoming mail in .MSG format with UNICODE support.
Note: I can trap the incoming mail. How to save this mail with .msg format
and with unicode support.
2. Can I restore mails if I save mails in .msg with unicode support.
Seeking your guidance
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
What kind of backup? *Where* do you want to store the messages?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
I love you Dmitry. Really you are giving lot of help.
Anyway, I have to take backup of all incoming mails and restore all mails
when user asks. this is very primary step of my project.
Thank you for giving immediate reply.
Thanks in advance.
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Post by Dmitry Streblechenko
You mean you have an Exchange Client Extension, not a COM add-in, right?
What kind of backup do you have in mind? Outlook folder? DB? MSG file?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am trying to
take backup of all incoming mails. I overridden OnDelivery method of
IExchExtSessionEvents interface. I can trap all incoming mails. But
how
can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Stephen Griffin
2005-08-16 17:35:06 UTC
Permalink
There are big problems with the StgCreateStorageEx workaround as well - the
transacted nature of MAPI does not mesh well with structured storage - you
get a perf issue with nested messages. And you still have the fidelity
issue - the body of the message will almost always change (subtly) on
reimportation.

Going with a custom format may be difficult, but if you're developing a
product to be sold or if you need to guarantee fidelity it's definitely the
way to go. It leaves you in control over what gets stored and how you
reconstruct the message from it.
Post by Dmitry Streblechenko
I have to disagree: you will have problems with any format. MIME might be a
good alternative, but it poses even greater conversion problems, especially
with the MAPI specific features, such as pure RTF messages, embedded OLE
attachments, etc.
You can of course develop your own format, but I suspect that it will take
you months to design and debug it to bring the number of bugs down to the
level that you will encounter with the MSG format.
The biggest MSG format problem is the messages with a large # of
recipients, but it easy to work around it by ussing StgCreateStorageEx
(Windows 2000 and up) rather than StgCreateDocfile.
Q171907 has sample code that shows how to save a message in the MSG
format: http://support.microsoft.com/?kbid=171907
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Stephen Griffin
I would NOT use MSG as a means for message archiving/backup. This message
format is not suitable for storing all the variety of messages you will
encounter in the wild. In particular, deeply nested messages and messages
with large numbers of recipients and/or attachments will present
unsolvable problems with this format. Also, you lose a great deal in
message fidelity in conversion to and from this format.
You will be much better off developing your own format in which to
archive the messages, or (since it looks like this may be an in-house
project), locating a third party who has already done this work.
Steve
Post by Dkds.Naidu
Hi Dmitry,
I am trying to design a utilty in Outlook where the user is
given the provision of saving a copy of the every incoming mail in a desired
location (currently in our server).
This utility will enable the user to resore/downlaod his mails
from the server once the user moves from his current place to a different
geographical location.
Currently am able to capture all the mails ( OnDelivery()
method of IExchExtSessionEvents) .How to save this mails in .MSG format with
UNICODE support?
I wonder whether am proceeding in the right direction in my quest to design
the above mentioned utilty!
1. How can I save the incoming mail in .MSG format with UNICODE support.
Note: I can trap the incoming mail. How to save this mail with .msg format
and with unicode support.
2. Can I restore mails if I save mails in .msg with unicode support.
Seeking your guidance
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
What kind of backup? *Where* do you want to store the messages?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
I love you Dmitry. Really you are giving lot of help.
Anyway, I have to take backup of all incoming mails and restore all mails
when user asks. this is very primary step of my project.
Thank you for giving immediate reply.
Thanks in advance.
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Post by Dmitry Streblechenko
You mean you have an Exchange Client Extension, not a COM add-in, right?
What kind of backup do you have in mind? Outlook folder? DB? MSG file?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am trying to
take backup of all incoming mails. I overridden OnDelivery method of
IExchExtSessionEvents interface. I can trap all incoming mails.
But how
can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Dkds.Naidu
2005-08-17 11:17:01 UTC
Permalink
Hi Dmitry,

According to your suggestion, I followed MICROSOFT Q171907 article. It
works fine except SUBJECT property. But, Backup mails lose SUBJECT only if
SUBJECT has non-english characters, otherwise it works fine.

How can I solve this problem?
How can I read .MSG files? (ie, how to download .MSG files into current pst?)

Thanks in advance.

With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
I have to disagree: you will have problems with any format. MIME might be a
good alternative, but it poses even greater conversion problems, especially
with the MAPI specific features, such as pure RTF messages, embedded OLE
attachments, etc.
You can of course develop your own format, but I suspect that it will take
you months to design and debug it to bring the number of bugs down to the
level that you will encounter with the MSG format.
The biggest MSG format problem is the messages with a large # of recipients,
but it easy to work around it by ussing StgCreateStorageEx (Windows 2000 and
up) rather than StgCreateDocfile.
http://support.microsoft.com/?kbid=171907
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Stephen Griffin
I would NOT use MSG as a means for message archiving/backup. This message
format is not suitable for storing all the variety of messages you will
encounter in the wild. In particular, deeply nested messages and messages
with large numbers of recipients and/or attachments will present unsolvable
problems with this format. Also, you lose a great deal in message fidelity
in conversion to and from this format.
You will be much better off developing your own format in which to archive
the messages, or (since it looks like this may be an in-house project),
locating a third party who has already done this work.
Steve
Post by Dkds.Naidu
Hi Dmitry,
I am trying to design a utilty in Outlook where the user is
given the provision of saving a copy of the every incoming mail in a desired
location (currently in our server).
This utility will enable the user to resore/downlaod his mails
from the server once the user moves from his current place to a different
geographical location.
Currently am able to capture all the mails ( OnDelivery()
method of IExchExtSessionEvents) .How to save this mails in .MSG format with
UNICODE support?
I wonder whether am proceeding in the right direction in my quest to design
the above mentioned utilty!
1. How can I save the incoming mail in .MSG format with UNICODE support.
Note: I can trap the incoming mail. How to save this mail with .msg format
and with unicode support.
2. Can I restore mails if I save mails in .msg with unicode support.
Seeking your guidance
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
What kind of backup? *Where* do you want to store the messages?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
I love you Dmitry. Really you are giving lot of help.
Anyway, I have to take backup of all incoming mails and restore all mails
when user asks. this is very primary step of my project.
Thank you for giving immediate reply.
Thanks in advance.
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Post by Dmitry Streblechenko
You mean you have an Exchange Client Extension, not a COM add-in, right?
What kind of backup do you have in mind? Outlook folder? DB? MSG file?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am trying to
take backup of all incoming mails. I overridden OnDelivery method of
IExchExtSessionEvents interface. I can trap all incoming mails. But
how
can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Stephen Griffin [MSFT]
2005-08-17 13:50:19 UTC
Permalink
I'll stress again that MSG is the wrong format. You just found another
reason why.

As for reading MSG files - you literally turn the code upside down -
everything you did to write one you do backwards. Check the source for
MFCMAPI for example code:
http://support.microsoft.com/kb/291794
Post by Dkds.Naidu
Hi Dmitry,
According to your suggestion, I followed MICROSOFT Q171907 article. It
works fine except SUBJECT property. But, Backup mails lose SUBJECT only if
SUBJECT has non-english characters, otherwise it works fine.
How can I solve this problem?
How can I read .MSG files? (ie, how to download .MSG files into current pst?)
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
I have to disagree: you will have problems with any format. MIME might be a
good alternative, but it poses even greater conversion problems, especially
with the MAPI specific features, such as pure RTF messages, embedded OLE
attachments, etc.
You can of course develop your own format, but I suspect that it will take
you months to design and debug it to bring the number of bugs down to the
level that you will encounter with the MSG format.
The biggest MSG format problem is the messages with a large # of recipients,
but it easy to work around it by ussing StgCreateStorageEx (Windows 2000 and
up) rather than StgCreateDocfile.
http://support.microsoft.com/?kbid=171907
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Stephen Griffin
I would NOT use MSG as a means for message archiving/backup. This message
format is not suitable for storing all the variety of messages you will
encounter in the wild. In particular, deeply nested messages and messages
with large numbers of recipients and/or attachments will present unsolvable
problems with this format. Also, you lose a great deal in message fidelity
in conversion to and from this format.
You will be much better off developing your own format in which to archive
the messages, or (since it looks like this may be an in-house project),
locating a third party who has already done this work.
Steve
Post by Dkds.Naidu
Hi Dmitry,
I am trying to design a utilty in Outlook where the user is
given the provision of saving a copy of the every incoming mail in a desired
location (currently in our server).
This utility will enable the user to resore/downlaod his mails
from the server once the user moves from his current place to a different
geographical location.
Currently am able to capture all the mails (
OnDelivery()
method of IExchExtSessionEvents) .How to save this mails in .MSG
format
with
UNICODE support?
I wonder whether am proceeding in the right direction in my quest to design
the above mentioned utilty!
1. How can I save the incoming mail in .MSG format with UNICODE support.
Note: I can trap the incoming mail. How to save this mail with .msg format
and with unicode support.
2. Can I restore mails if I save mails in .msg with unicode support.
Seeking your guidance
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
What kind of backup? *Where* do you want to store the messages?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
I love you Dmitry. Really you are giving lot of help.
Anyway, I have to take backup of all incoming mails and restore
all
mails
when user asks. this is very primary step of my project.
Thank you for giving immediate reply.
Thanks in advance.
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Post by Dmitry Streblechenko
You mean you have an Exchange Client Extension, not a COM add-in, right?
What kind of backup do you have in mind? Outlook folder? DB? MSG file?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am trying to
take backup of all incoming mails. I overridden OnDelivery
method
of
IExchExtSessionEvents interface. I can trap all incoming mails. But
how
can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Dkds.Naidu
2005-08-18 13:59:06 UTC
Permalink
Hi Stephen,

Thank you for your nice discussion. I am doing R&D with your suggestions.
But I didnt get any articles in microsoft. Can you suggest me where can I
get the exact information to create our own message format?

Thanks in advance.

With regareds,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Stephen Griffin [MSFT]
I'll stress again that MSG is the wrong format. You just found another
reason why.
As for reading MSG files - you literally turn the code upside down -
everything you did to write one you do backwards. Check the source for
http://support.microsoft.com/kb/291794
Post by Dkds.Naidu
Hi Dmitry,
According to your suggestion, I followed MICROSOFT Q171907 article. It
works fine except SUBJECT property. But, Backup mails lose SUBJECT only if
SUBJECT has non-english characters, otherwise it works fine.
How can I solve this problem?
How can I read .MSG files? (ie, how to download .MSG files into current pst?)
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
I have to disagree: you will have problems with any format. MIME might be a
good alternative, but it poses even greater conversion problems, especially
with the MAPI specific features, such as pure RTF messages, embedded OLE
attachments, etc.
You can of course develop your own format, but I suspect that it will take
you months to design and debug it to bring the number of bugs down to the
level that you will encounter with the MSG format.
The biggest MSG format problem is the messages with a large # of recipients,
but it easy to work around it by ussing StgCreateStorageEx (Windows 2000 and
up) rather than StgCreateDocfile.
http://support.microsoft.com/?kbid=171907
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Stephen Griffin
I would NOT use MSG as a means for message archiving/backup. This message
format is not suitable for storing all the variety of messages you will
encounter in the wild. In particular, deeply nested messages and messages
with large numbers of recipients and/or attachments will present unsolvable
problems with this format. Also, you lose a great deal in message fidelity
in conversion to and from this format.
You will be much better off developing your own format in which to archive
the messages, or (since it looks like this may be an in-house project),
locating a third party who has already done this work.
Steve
Post by Dkds.Naidu
Hi Dmitry,
I am trying to design a utilty in Outlook where the user is
given the provision of saving a copy of the every incoming mail in a desired
location (currently in our server).
This utility will enable the user to resore/downlaod his mails
from the server once the user moves from his current place to a different
geographical location.
Currently am able to capture all the mails ( OnDelivery()
method of IExchExtSessionEvents) .How to save this mails in .MSG
format
with
UNICODE support?
I wonder whether am proceeding in the right direction in my quest to design
the above mentioned utilty!
1. How can I save the incoming mail in .MSG format with UNICODE support.
Note: I can trap the incoming mail. How to save this mail with .msg format
and with unicode support.
2. Can I restore mails if I save mails in .msg with unicode support.
Seeking your guidance
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
What kind of backup? *Where* do you want to store the messages?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
I love you Dmitry. Really you are giving lot of help.
Anyway, I have to take backup of all incoming mails and restore
all
mails
when user asks. this is very primary step of my project.
Thank you for giving immediate reply.
Thanks in advance.
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Post by Dmitry Streblechenko
You mean you have an Exchange Client Extension, not a COM add-in,
right?
What kind of backup do you have in mind? Outlook folder? DB? MSG file?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am
trying to
take backup of all incoming mails. I overridden OnDelivery
method
of
IExchExtSessionEvents interface. I can trap all incoming mails. But
how
can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Stephen Griffin [MSFT]
2005-08-18 14:11:23 UTC
Permalink
The only information you need is how to use GetProps. :)

Creating your own format means creating your *own* format. You get to make
it all up. If I were doing it, I might consider using XML, using base64 to
encode all the binary and text properties. But it's really up to you.
Post by Dkds.Naidu
Hi Stephen,
Thank you for your nice discussion. I am doing R&D with your suggestions.
But I didnt get any articles in microsoft. Can you suggest me where can I
get the exact information to create our own message format?
Thanks in advance.
With regareds,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Stephen Griffin [MSFT]
I'll stress again that MSG is the wrong format. You just found another
reason why.
As for reading MSG files - you literally turn the code upside down -
everything you did to write one you do backwards. Check the source for
http://support.microsoft.com/kb/291794
Post by Dkds.Naidu
Hi Dmitry,
According to your suggestion, I followed MICROSOFT Q171907
article.
It
works fine except SUBJECT property. But, Backup mails lose SUBJECT only if
SUBJECT has non-english characters, otherwise it works fine.
How can I solve this problem?
How can I read .MSG files? (ie, how to download .MSG files into current pst?)
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
I have to disagree: you will have problems with any format. MIME might
be
a
good alternative, but it poses even greater conversion problems, especially
with the MAPI specific features, such as pure RTF messages, embedded OLE
attachments, etc.
You can of course develop your own format, but I suspect that it will take
you months to design and debug it to bring the number of bugs down to the
level that you will encounter with the MSG format.
The biggest MSG format problem is the messages with a large # of recipients,
but it easy to work around it by ussing StgCreateStorageEx (Windows
2000
and
up) rather than StgCreateDocfile.
http://support.microsoft.com/?kbid=171907
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Stephen Griffin
I would NOT use MSG as a means for message archiving/backup. This message
format is not suitable for storing all the variety of messages you will
encounter in the wild. In particular, deeply nested messages and messages
with large numbers of recipients and/or attachments will present unsolvable
problems with this format. Also, you lose a great deal in message fidelity
in conversion to and from this format.
You will be much better off developing your own format in which to archive
the messages, or (since it looks like this may be an in-house project),
locating a third party who has already done this work.
Steve
Post by Dkds.Naidu
Hi Dmitry,
I am trying to design a utilty in Outlook where the
user
is
given the provision of saving a copy of the every incoming mail in
a
desired
location (currently in our server).
This utility will enable the user to resore/downlaod
his
mails
from the server once the user moves from his current place to a different
geographical location.
Currently am able to capture all the mails ( OnDelivery()
method of IExchExtSessionEvents) .How to save this mails in .MSG
format
with
UNICODE support?
I wonder whether am proceeding in the right direction in my quest
to
design
the above mentioned utilty!
1. How can I save the incoming mail in .MSG format with UNICODE support.
Note: I can trap the incoming mail. How to save this mail with .msg format
and with unicode support.
2. Can I restore mails if I save mails in .msg with unicode support.
Seeking your guidance
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
What kind of backup? *Where* do you want to store the messages?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
I love you Dmitry. Really you are giving lot of help.
Anyway, I have to take backup of all incoming mails and restore
all
mails
when user asks. this is very primary step of my project.
Thank you for giving immediate reply.
Thanks in advance.
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Post by Dmitry Streblechenko
You mean you have an Exchange Client Extension, not a COM add-in,
right?
What kind of backup do you have in mind? Outlook folder? DB?
MSG
file?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am
trying to
take backup of all incoming mails. I overridden OnDelivery
method
of
IExchExtSessionEvents interface. I can trap all incoming
mails.
But
how
can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Dmitry Streblechenko
2005-08-17 17:04:41 UTC
Permalink
Can you retrieve PR_SUBJECT using HrGetOneProp?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
According to your suggestion, I followed MICROSOFT Q171907 article. It
works fine except SUBJECT property. But, Backup mails lose SUBJECT only if
SUBJECT has non-english characters, otherwise it works fine.
How can I solve this problem?
How can I read .MSG files? (ie, how to download .MSG files into current pst?)
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
I have to disagree: you will have problems with any format. MIME might be a
good alternative, but it poses even greater conversion problems, especially
with the MAPI specific features, such as pure RTF messages, embedded OLE
attachments, etc.
You can of course develop your own format, but I suspect that it will take
you months to design and debug it to bring the number of bugs down to the
level that you will encounter with the MSG format.
The biggest MSG format problem is the messages with a large # of recipients,
but it easy to work around it by ussing StgCreateStorageEx (Windows 2000 and
up) rather than StgCreateDocfile.
http://support.microsoft.com/?kbid=171907
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Stephen Griffin
I would NOT use MSG as a means for message archiving/backup. This message
format is not suitable for storing all the variety of messages you will
encounter in the wild. In particular, deeply nested messages and messages
with large numbers of recipients and/or attachments will present unsolvable
problems with this format. Also, you lose a great deal in message fidelity
in conversion to and from this format.
You will be much better off developing your own format in which to archive
the messages, or (since it looks like this may be an in-house project),
locating a third party who has already done this work.
Steve
Post by Dkds.Naidu
Hi Dmitry,
I am trying to design a utilty in Outlook where the user is
given the provision of saving a copy of the every incoming mail in a desired
location (currently in our server).
This utility will enable the user to resore/downlaod his mails
from the server once the user moves from his current place to a different
geographical location.
Currently am able to capture all the mails (
OnDelivery()
method of IExchExtSessionEvents) .How to save this mails in .MSG
format
with
UNICODE support?
I wonder whether am proceeding in the right direction in my quest to design
the above mentioned utilty!
1. How can I save the incoming mail in .MSG format with UNICODE support.
Note: I can trap the incoming mail. How to save this mail with .msg format
and with unicode support.
2. Can I restore mails if I save mails in .msg with unicode support.
Seeking your guidance
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
What kind of backup? *Where* do you want to store the messages?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
I love you Dmitry. Really you are giving lot of help.
Anyway, I have to take backup of all incoming mails and restore
all
mails
when user asks. this is very primary step of my project.
Thank you for giving immediate reply.
Thanks in advance.
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Post by Dmitry Streblechenko
You mean you have an Exchange Client Extension, not a COM add-in, right?
What kind of backup do you have in mind? Outlook folder? DB? MSG file?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am trying to
take backup of all incoming mails. I overridden OnDelivery
method
of
IExchExtSessionEvents interface. I can trap all incoming mails. But
how
can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Dkds.Naidu
2005-08-18 07:01:08 UTC
Permalink
Hi Dmitry,

I can get the subject with HrGetOneProp.

But, actual problem is:

If incoming mail has non-english characters in the subject field, then only
it has question marks in the backup mail.(without using PR_SUBJECT).
else it works fine.(ie. ascii characters in the subject field)

No problem with BODY even non-english characters.

My doubt is:

I tried to save one chinese mail in the following steps. Then I cant see
the correct subject. It replaces with question marks in the subject field
only.
Open OUTLOOK -> Just select one non-english mail -> click
on &File of Menu Bar -> click on "Save As..." menu item -> Imeediately
Outlook popup one SaveAs dialog box -> Goto "SaveAsType" combo box
1. select "Outlook Message Format" (third one) -> then save this mail in the
desired location.(now it lose subject only)
2. select "Outlook Message Format - UNICODE" (fourth one) -> then save this
mail in the desired location. (now it has exact subject).

How can I do this programmatically?

This is the only problem while taking backup. How can I solve this problem?
Just I tried to save all incoming mails with currentdatecurrentprofile.MSG.

How can I fix it?

Thanks in advance.

With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
Can you retrieve PR_SUBJECT using HrGetOneProp?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
According to your suggestion, I followed MICROSOFT Q171907 article. It
works fine except SUBJECT property. But, Backup mails lose SUBJECT only if
SUBJECT has non-english characters, otherwise it works fine.
How can I solve this problem?
How can I read .MSG files? (ie, how to download .MSG files into current pst?)
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
I have to disagree: you will have problems with any format. MIME might be a
good alternative, but it poses even greater conversion problems, especially
with the MAPI specific features, such as pure RTF messages, embedded OLE
attachments, etc.
You can of course develop your own format, but I suspect that it will take
you months to design and debug it to bring the number of bugs down to the
level that you will encounter with the MSG format.
The biggest MSG format problem is the messages with a large # of recipients,
but it easy to work around it by ussing StgCreateStorageEx (Windows 2000 and
up) rather than StgCreateDocfile.
http://support.microsoft.com/?kbid=171907
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Stephen Griffin
I would NOT use MSG as a means for message archiving/backup. This message
format is not suitable for storing all the variety of messages you will
encounter in the wild. In particular, deeply nested messages and messages
with large numbers of recipients and/or attachments will present unsolvable
problems with this format. Also, you lose a great deal in message fidelity
in conversion to and from this format.
You will be much better off developing your own format in which to archive
the messages, or (since it looks like this may be an in-house project),
locating a third party who has already done this work.
Steve
Post by Dkds.Naidu
Hi Dmitry,
I am trying to design a utilty in Outlook where the user is
given the provision of saving a copy of the every incoming mail in a desired
location (currently in our server).
This utility will enable the user to resore/downlaod his mails
from the server once the user moves from his current place to a different
geographical location.
Currently am able to capture all the mails ( OnDelivery()
method of IExchExtSessionEvents) .How to save this mails in .MSG
format
with
UNICODE support?
I wonder whether am proceeding in the right direction in my quest to design
the above mentioned utilty!
1. How can I save the incoming mail in .MSG format with UNICODE support.
Note: I can trap the incoming mail. How to save this mail with .msg format
and with unicode support.
2. Can I restore mails if I save mails in .msg with unicode support.
Seeking your guidance
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
What kind of backup? *Where* do you want to store the messages?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
I love you Dmitry. Really you are giving lot of help.
Anyway, I have to take backup of all incoming mails and restore
all
mails
when user asks. this is very primary step of my project.
Thank you for giving immediate reply.
Thanks in advance.
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Post by Dmitry Streblechenko
You mean you have an Exchange Client Extension, not a COM add-in,
right?
What kind of backup do you have in mind? Outlook folder? DB? MSG file?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am
trying to
take backup of all incoming mails. I overridden OnDelivery
method
of
IExchExtSessionEvents interface. I can trap all incoming mails. But
how
can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Dkds.Naidu
2005-08-18 14:10:02 UTC
Permalink
Hi Dmitry,
I tried with the following code snippet. But problem is there. How
can I fix it?

LPSPropValue value;
HrGetOneProp(lpIncomingMessage,PR_SUBJECT_W,&value);
MessageBoxW(NULL,value->Value.lpszW,L"",MB_OK);
SPropValue setVal;
setVal.ulPropTag = PR_SUBJECT_W;
setVal.Value.lpszW = value->Value.lpszW;
MessageBoxW(NULL,setVal.Value.lpszW,L"",MB_OK);
HrSetOneProp(pBackupIMsg,&setVal);

For restoring:

I tried with
CComVariant myFolder(DISP_E_PARAMNOTFOUND, VT_ERROR);
CComPtr<Outlook::_MailItem> olRestoreMail;
spApp->CreateItemFromTemplate("C:\\backup.msg",myFolder,(IDispatch**)&olRestoreMail);

But its not downloaded into my account. How to solve this problem?

Thanks in advance.


With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
Can you retrieve PR_SUBJECT using HrGetOneProp?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
According to your suggestion, I followed MICROSOFT Q171907 article. It
works fine except SUBJECT property. But, Backup mails lose SUBJECT only if
SUBJECT has non-english characters, otherwise it works fine.
How can I solve this problem?
How can I read .MSG files? (ie, how to download .MSG files into current pst?)
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
I have to disagree: you will have problems with any format. MIME might be a
good alternative, but it poses even greater conversion problems, especially
with the MAPI specific features, such as pure RTF messages, embedded OLE
attachments, etc.
You can of course develop your own format, but I suspect that it will take
you months to design and debug it to bring the number of bugs down to the
level that you will encounter with the MSG format.
The biggest MSG format problem is the messages with a large # of recipients,
but it easy to work around it by ussing StgCreateStorageEx (Windows 2000 and
up) rather than StgCreateDocfile.
http://support.microsoft.com/?kbid=171907
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Stephen Griffin
I would NOT use MSG as a means for message archiving/backup. This message
format is not suitable for storing all the variety of messages you will
encounter in the wild. In particular, deeply nested messages and messages
with large numbers of recipients and/or attachments will present unsolvable
problems with this format. Also, you lose a great deal in message fidelity
in conversion to and from this format.
You will be much better off developing your own format in which to archive
the messages, or (since it looks like this may be an in-house project),
locating a third party who has already done this work.
Steve
Post by Dkds.Naidu
Hi Dmitry,
I am trying to design a utilty in Outlook where the user is
given the provision of saving a copy of the every incoming mail in a desired
location (currently in our server).
This utility will enable the user to resore/downlaod his mails
from the server once the user moves from his current place to a different
geographical location.
Currently am able to capture all the mails ( OnDelivery()
method of IExchExtSessionEvents) .How to save this mails in .MSG
format
with
UNICODE support?
I wonder whether am proceeding in the right direction in my quest to design
the above mentioned utilty!
1. How can I save the incoming mail in .MSG format with UNICODE support.
Note: I can trap the incoming mail. How to save this mail with .msg format
and with unicode support.
2. Can I restore mails if I save mails in .msg with unicode support.
Seeking your guidance
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
What kind of backup? *Where* do you want to store the messages?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
I love you Dmitry. Really you are giving lot of help.
Anyway, I have to take backup of all incoming mails and restore
all
mails
when user asks. this is very primary step of my project.
Thank you for giving immediate reply.
Thanks in advance.
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Post by Dmitry Streblechenko
You mean you have an Exchange Client Extension, not a COM add-in,
right?
What kind of backup do you have in mind? Outlook folder? DB? MSG file?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am
trying to
take backup of all incoming mails. I overridden OnDelivery
method
of
IExchExtSessionEvents interface. I can trap all incoming mails. But
how
can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Dmitry Streblechenko
2005-08-18 16:53:36 UTC
Permalink
So does the message box display the correct value?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
I tried with the following code snippet. But problem is there. How
can I fix it?
LPSPropValue value;
HrGetOneProp(lpIncomingMessage,PR_SUBJECT_W,&value);
MessageBoxW(NULL,value->Value.lpszW,L"",MB_OK);
SPropValue setVal;
setVal.ulPropTag = PR_SUBJECT_W;
setVal.Value.lpszW = value->Value.lpszW;
MessageBoxW(NULL,setVal.Value.lpszW,L"",MB_OK);
HrSetOneProp(pBackupIMsg,&setVal);
I tried with
CComVariant myFolder(DISP_E_PARAMNOTFOUND, VT_ERROR);
CComPtr<Outlook::_MailItem> olRestoreMail;
spApp->CreateItemFromTemplate("C:\\backup.msg",myFolder,(IDispatch**)&olRestoreMail);
But its not downloaded into my account. How to solve this problem?
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
Can you retrieve PR_SUBJECT using HrGetOneProp?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
According to your suggestion, I followed MICROSOFT Q171907
article.
It
works fine except SUBJECT property. But, Backup mails lose SUBJECT only if
SUBJECT has non-english characters, otherwise it works fine.
How can I solve this problem?
How can I read .MSG files? (ie, how to download .MSG files into current pst?)
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
I have to disagree: you will have problems with any format. MIME might
be
a
good alternative, but it poses even greater conversion problems, especially
with the MAPI specific features, such as pure RTF messages, embedded OLE
attachments, etc.
You can of course develop your own format, but I suspect that it will take
you months to design and debug it to bring the number of bugs down to the
level that you will encounter with the MSG format.
The biggest MSG format problem is the messages with a large # of recipients,
but it easy to work around it by ussing StgCreateStorageEx (Windows
2000
and
up) rather than StgCreateDocfile.
http://support.microsoft.com/?kbid=171907
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Stephen Griffin
I would NOT use MSG as a means for message archiving/backup. This message
format is not suitable for storing all the variety of messages you will
encounter in the wild. In particular, deeply nested messages and messages
with large numbers of recipients and/or attachments will present unsolvable
problems with this format. Also, you lose a great deal in message fidelity
in conversion to and from this format.
You will be much better off developing your own format in which to archive
the messages, or (since it looks like this may be an in-house project),
locating a third party who has already done this work.
Steve
Post by Dkds.Naidu
Hi Dmitry,
I am trying to design a utilty in Outlook where the
user
is
given the provision of saving a copy of the every incoming mail in
a
desired
location (currently in our server).
This utility will enable the user to resore/downlaod
his
mails
from the server once the user moves from his current place to a different
geographical location.
Currently am able to capture all the mails ( OnDelivery()
method of IExchExtSessionEvents) .How to save this mails in .MSG
format
with
UNICODE support?
I wonder whether am proceeding in the right direction in my quest
to
design
the above mentioned utilty!
1. How can I save the incoming mail in .MSG format with UNICODE support.
Note: I can trap the incoming mail. How to save this mail with .msg format
and with unicode support.
2. Can I restore mails if I save mails in .msg with unicode support.
Seeking your guidance
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
What kind of backup? *Where* do you want to store the messages?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
I love you Dmitry. Really you are giving lot of help.
Anyway, I have to take backup of all incoming mails and restore
all
mails
when user asks. this is very primary step of my project.
Thank you for giving immediate reply.
Thanks in advance.
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Post by Dmitry Streblechenko
You mean you have an Exchange Client Extension, not a COM add-in,
right?
What kind of backup do you have in mind? Outlook folder? DB?
MSG
file?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am
trying to
take backup of all incoming mails. I overridden OnDelivery
method
of
IExchExtSessionEvents interface. I can trap all incoming
mails.
But
how
can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Dkds.Naidu
2005-08-22 04:21:02 UTC
Permalink
Hi Dmitry,


Yes. MessageBoxW displays correct value.


Thanks in advance.


With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
So does the message box display the correct value?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
I tried with the following code snippet. But problem is there. How
can I fix it?
LPSPropValue value;
HrGetOneProp(lpIncomingMessage,PR_SUBJECT_W,&value);
MessageBoxW(NULL,value->Value.lpszW,L"",MB_OK);
SPropValue setVal;
setVal.ulPropTag = PR_SUBJECT_W;
setVal.Value.lpszW = value->Value.lpszW;
MessageBoxW(NULL,setVal.Value.lpszW,L"",MB_OK);
HrSetOneProp(pBackupIMsg,&setVal);
I tried with
CComVariant myFolder(DISP_E_PARAMNOTFOUND, VT_ERROR);
CComPtr<Outlook::_MailItem> olRestoreMail;
spApp->CreateItemFromTemplate("C:\\backup.msg",myFolder,(IDispatch**)&olRestoreMail);
But its not downloaded into my account. How to solve this problem?
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
Can you retrieve PR_SUBJECT using HrGetOneProp?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
According to your suggestion, I followed MICROSOFT Q171907
article.
It
works fine except SUBJECT property. But, Backup mails lose SUBJECT only if
SUBJECT has non-english characters, otherwise it works fine.
How can I solve this problem?
How can I read .MSG files? (ie, how to download .MSG files into current pst?)
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
I have to disagree: you will have problems with any format. MIME might
be
a
good alternative, but it poses even greater conversion problems, especially
with the MAPI specific features, such as pure RTF messages, embedded OLE
attachments, etc.
You can of course develop your own format, but I suspect that it will take
you months to design and debug it to bring the number of bugs down to the
level that you will encounter with the MSG format.
The biggest MSG format problem is the messages with a large # of recipients,
but it easy to work around it by ussing StgCreateStorageEx (Windows
2000
and
up) rather than StgCreateDocfile.
http://support.microsoft.com/?kbid=171907
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Stephen Griffin
I would NOT use MSG as a means for message archiving/backup. This message
format is not suitable for storing all the variety of messages you will
encounter in the wild. In particular, deeply nested messages and messages
with large numbers of recipients and/or attachments will present unsolvable
problems with this format. Also, you lose a great deal in message fidelity
in conversion to and from this format.
You will be much better off developing your own format in which to archive
the messages, or (since it looks like this may be an in-house project),
locating a third party who has already done this work.
Steve
Post by Dkds.Naidu
Hi Dmitry,
I am trying to design a utilty in Outlook where the
user
is
given the provision of saving a copy of the every incoming mail in
a
desired
location (currently in our server).
This utility will enable the user to resore/downlaod
his
mails
from the server once the user moves from his current place to a different
geographical location.
Currently am able to capture all the mails ( OnDelivery()
method of IExchExtSessionEvents) .How to save this mails in .MSG
format
with
UNICODE support?
I wonder whether am proceeding in the right direction in my quest
to
design
the above mentioned utilty!
1. How can I save the incoming mail in .MSG format with UNICODE support.
Note: I can trap the incoming mail. How to save this mail with .msg
format
and with unicode support.
2. Can I restore mails if I save mails in .msg with unicode support.
Seeking your guidance
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
What kind of backup? *Where* do you want to store the messages?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
I love you Dmitry. Really you are giving lot of help.
Anyway, I have to take backup of all incoming mails and restore
all
mails
when user asks. this is very primary step of my project.
Thank you for giving immediate reply.
Thanks in advance.
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Post by Dmitry Streblechenko
You mean you have an Exchange Client Extension, not a COM add-in,
right?
What kind of backup do you have in mind? Outlook folder? DB?
MSG
file?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am
trying to
take backup of all incoming mails. I overridden OnDelivery
method
of
IExchExtSessionEvents interface. I can trap all incoming
mails.
But
how
can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Dmitry Streblechenko
2005-08-22 18:28:14 UTC
Permalink
What happens if you try to read PR_SUBJECT_W from pBackupIMsg immediately
after setting it?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
Yes. MessageBoxW displays correct value.
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
So does the message box display the correct value?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
I tried with the following code snippet. But problem is there. How
can I fix it?
LPSPropValue value;
HrGetOneProp(lpIncomingMessage,PR_SUBJECT_W,&value);
MessageBoxW(NULL,value->Value.lpszW,L"",MB_OK);
SPropValue setVal;
setVal.ulPropTag = PR_SUBJECT_W;
setVal.Value.lpszW = value->Value.lpszW;
MessageBoxW(NULL,setVal.Value.lpszW,L"",MB_OK);
HrSetOneProp(pBackupIMsg,&setVal);
I tried with
CComVariant myFolder(DISP_E_PARAMNOTFOUND, VT_ERROR);
CComPtr<Outlook::_MailItem> olRestoreMail;
spApp->CreateItemFromTemplate("C:\\backup.msg",myFolder,(IDispatch**)&olRestoreMail);
But its not downloaded into my account. How to solve this problem?
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
Can you retrieve PR_SUBJECT using HrGetOneProp?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
According to your suggestion, I followed MICROSOFT Q171907
article.
It
works fine except SUBJECT property. But, Backup mails lose SUBJECT
only
if
SUBJECT has non-english characters, otherwise it works fine.
How can I solve this problem?
How can I read .MSG files? (ie, how to download .MSG files into
current
pst?)
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
I have to disagree: you will have problems with any format. MIME might
be
a
good alternative, but it poses even greater conversion problems, especially
with the MAPI specific features, such as pure RTF messages,
embedded
OLE
attachments, etc.
You can of course develop your own format, but I suspect that it
will
take
you months to design and debug it to bring the number of bugs down
to
the
level that you will encounter with the MSG format.
The biggest MSG format problem is the messages with a large # of recipients,
but it easy to work around it by ussing StgCreateStorageEx (Windows
2000
and
up) rather than StgCreateDocfile.
http://support.microsoft.com/?kbid=171907
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Stephen Griffin
I would NOT use MSG as a means for message archiving/backup. This message
format is not suitable for storing all the variety of messages you will
encounter in the wild. In particular, deeply nested messages and messages
with large numbers of recipients and/or attachments will present unsolvable
problems with this format. Also, you lose a great deal in message fidelity
in conversion to and from this format.
You will be much better off developing your own format in which
to
archive
the messages, or (since it looks like this may be an in-house project),
locating a third party who has already done this work.
Steve
Post by Dkds.Naidu
Hi Dmitry,
I am trying to design a utilty in Outlook where the
user
is
given the provision of saving a copy of the every incoming mail in
a
desired
location (currently in our server).
This utility will enable the user to resore/downlaod
his
mails
from the server once the user moves from his current place to a
different
geographical location.
Currently am able to capture all the mails ( OnDelivery()
method of IExchExtSessionEvents) .How to save this mails in .MSG
format
with
UNICODE support?
I wonder whether am proceeding in the right direction in my quest
to
design
the above mentioned utilty!
1. How can I save the incoming mail in .MSG format with UNICODE
support.
Note: I can trap the incoming mail. How to save this mail with .msg
format
and with unicode support.
2. Can I restore mails if I save mails in .msg with unicode support.
Seeking your guidance
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
What kind of backup? *Where* do you want to store the messages?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
I love you Dmitry. Really you are giving lot of help.
Anyway, I have to take backup of all incoming mails and restore
all
mails
when user asks. this is very primary step of my project.
Thank you for giving immediate reply.
Thanks in advance.
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Post by Dmitry Streblechenko
You mean you have an Exchange Client Extension, not a COM
add-in,
right?
What kind of backup do you have in mind? Outlook folder? DB?
MSG
file?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I
am
trying to
take backup of all incoming mails. I overridden OnDelivery
method
of
IExchExtSessionEvents interface. I can trap all incoming
mails.
But
how
can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know
MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Dkds.Naidu
2005-08-23 04:37:02 UTC
Permalink
Hi Dmitry,


Thank you for your response.


After setting subject,it doesnt have any problems. It works fine.
attachments, body, large number of reciepients, etc all are working fine
except SUBJECT.

How can I provide UNICODE support through programmatically?
I saved each mail as a .MSG format only. I have to take .MSG with UNICODE
support. But I am missing UNICODE support. U can check this problem with
saveas menuitem of FILE menu of OUTLOOK. While doing saveas of OUTLOOK mail
with .MSG only(without UNICODE support), it lose subject if it has UNICODE
characters otherwise it works fine.

Thanks in advance,

With regards,
--
DKDS.Naidu,
Post by Dmitry Streblechenko
What happens if you try to read PR_SUBJECT_W from pBackupIMsg immediately
after setting it?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
Yes. MessageBoxW displays correct value.
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
So does the message box display the correct value?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
I tried with the following code snippet. But problem is there. How
can I fix it?
LPSPropValue value;
HrGetOneProp(lpIncomingMessage,PR_SUBJECT_W,&value);
MessageBoxW(NULL,value->Value.lpszW,L"",MB_OK);
SPropValue setVal;
setVal.ulPropTag = PR_SUBJECT_W;
setVal.Value.lpszW = value->Value.lpszW;
MessageBoxW(NULL,setVal.Value.lpszW,L"",MB_OK);
HrSetOneProp(pBackupIMsg,&setVal);
I tried with
CComVariant myFolder(DISP_E_PARAMNOTFOUND, VT_ERROR);
CComPtr<Outlook::_MailItem> olRestoreMail;
spApp->CreateItemFromTemplate("C:\\backup.msg",myFolder,(IDispatch**)&olRestoreMail);
But its not downloaded into my account. How to solve this problem?
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
Can you retrieve PR_SUBJECT using HrGetOneProp?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
According to your suggestion, I followed MICROSOFT Q171907
article.
It
works fine except SUBJECT property. But, Backup mails lose SUBJECT
only
if
SUBJECT has non-english characters, otherwise it works fine.
How can I solve this problem?
How can I read .MSG files? (ie, how to download .MSG files into
current
pst?)
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
I have to disagree: you will have problems with any format. MIME might
be
a
good alternative, but it poses even greater conversion problems,
especially
with the MAPI specific features, such as pure RTF messages,
embedded
OLE
attachments, etc.
You can of course develop your own format, but I suspect that it
will
take
you months to design and debug it to bring the number of bugs down
to
the
level that you will encounter with the MSG format.
The biggest MSG format problem is the messages with a large # of
recipients,
but it easy to work around it by ussing StgCreateStorageEx (Windows
2000
and
up) rather than StgCreateDocfile.
Q171907 has sample code that shows how to save a message in the MSG
http://support.microsoft.com/?kbid=171907
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Stephen Griffin
I would NOT use MSG as a means for message archiving/backup. This
message
format is not suitable for storing all the variety of messages you will
encounter in the wild. In particular, deeply nested messages and
messages
with large numbers of recipients and/or attachments will present
unsolvable
problems with this format. Also, you lose a great deal in message
fidelity
in conversion to and from this format.
You will be much better off developing your own format in which
to
archive
the messages, or (since it looks like this may be an in-house
project),
locating a third party who has already done this work.
Steve
Post by Dkds.Naidu
Hi Dmitry,
I am trying to design a utilty in Outlook where the
user
is
given the provision of saving a copy of the every incoming mail in
a
desired
location (currently in our server).
This utility will enable the user to resore/downlaod
his
mails
from the server once the user moves from his current place to a
different
geographical location.
Currently am able to capture all the mails (
OnDelivery()
method of IExchExtSessionEvents) .How to save this mails in .MSG
format
with
UNICODE support?
I wonder whether am proceeding in the right direction in my quest
to
design
the above mentioned utilty!
1. How can I save the incoming mail in .MSG format with UNICODE
support.
Note: I can trap the incoming mail. How to save this mail with .msg
format
and with unicode support.
2. Can I restore mails if I save mails in .msg with unicode
support.
Seeking your guidance
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
What kind of backup? *Where* do you want to store the messages?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
I love you Dmitry. Really you are giving lot of help.
Anyway, I have to take backup of all incoming mails and
restore
all
mails
when user asks. this is very primary step of my project.
Thank you for giving immediate reply.
Thanks in advance.
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Post by Dmitry Streblechenko
You mean you have an Exchange Client Extension, not a COM
add-in,
right?
What kind of backup do you have in mind? Outlook folder? DB?
MSG
file?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I
am
trying to
take backup of all incoming mails. I overridden OnDelivery
method
of
IExchExtSessionEvents interface. I can trap all incoming
mails.
But
how
can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know
MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Dmitry Streblechenko
2005-08-23 16:40:55 UTC
Permalink
Do you mean you display PR_SUBJECT_W before setting it on pBackupIMsg, set
it, then read it back from pBackupIMsg and display it again, you get the
expected value in both cases?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
Thank you for your response.
After setting subject,it doesnt have any problems. It works fine.
attachments, body, large number of reciepients, etc all are working fine
except SUBJECT.
How can I provide UNICODE support through programmatically?
I saved each mail as a .MSG format only. I have to take .MSG with UNICODE
support. But I am missing UNICODE support. U can check this problem with
saveas menuitem of FILE menu of OUTLOOK. While doing saveas of OUTLOOK mail
with .MSG only(without UNICODE support), it lose subject if it has UNICODE
characters otherwise it works fine.
Thanks in advance,
With regards,
--
DKDS.Naidu,
Post by Dmitry Streblechenko
What happens if you try to read PR_SUBJECT_W from pBackupIMsg immediately
after setting it?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
Yes. MessageBoxW displays correct value.
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
So does the message box display the correct value?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
I tried with the following code snippet. But problem is
there.
How
can I fix it?
LPSPropValue value;
HrGetOneProp(lpIncomingMessage,PR_SUBJECT_W,&value);
MessageBoxW(NULL,value->Value.lpszW,L"",MB_OK);
SPropValue setVal;
setVal.ulPropTag = PR_SUBJECT_W;
setVal.Value.lpszW = value->Value.lpszW;
MessageBoxW(NULL,setVal.Value.lpszW,L"",MB_OK);
HrSetOneProp(pBackupIMsg,&setVal);
I tried with
CComVariant myFolder(DISP_E_PARAMNOTFOUND, VT_ERROR);
CComPtr<Outlook::_MailItem> olRestoreMail;
spApp->CreateItemFromTemplate("C:\\backup.msg",myFolder,(IDispatch**)&olRestoreMail);
But its not downloaded into my account. How to solve this problem?
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
Can you retrieve PR_SUBJECT using HrGetOneProp?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
According to your suggestion, I followed MICROSOFT Q171907
article.
It
works fine except SUBJECT property. But, Backup mails lose SUBJECT
only
if
SUBJECT has non-english characters, otherwise it works fine.
How can I solve this problem?
How can I read .MSG files? (ie, how to download .MSG files into
current
pst?)
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
I have to disagree: you will have problems with any format. MIME might
be
a
good alternative, but it poses even greater conversion problems,
especially
with the MAPI specific features, such as pure RTF messages,
embedded
OLE
attachments, etc.
You can of course develop your own format, but I suspect that it
will
take
you months to design and debug it to bring the number of bugs down
to
the
level that you will encounter with the MSG format.
The biggest MSG format problem is the messages with a large # of
recipients,
but it easy to work around it by ussing StgCreateStorageEx (Windows
2000
and
up) rather than StgCreateDocfile.
Q171907 has sample code that shows how to save a message in the MSG
http://support.microsoft.com/?kbid=171907
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Stephen Griffin
I would NOT use MSG as a means for message archiving/backup. This
message
format is not suitable for storing all the variety of messages
you
will
encounter in the wild. In particular, deeply nested messages and
messages
with large numbers of recipients and/or attachments will present
unsolvable
problems with this format. Also, you lose a great deal in message
fidelity
in conversion to and from this format.
You will be much better off developing your own format in which
to
archive
the messages, or (since it looks like this may be an in-house
project),
locating a third party who has already done this work.
Steve
Post by Dkds.Naidu
Hi Dmitry,
I am trying to design a utilty in Outlook where the
user
is
given the provision of saving a copy of the every incoming
mail
in
a
desired
location (currently in our server).
This utility will enable the user to
resore/downlaod
his
mails
from the server once the user moves from his current place to a
different
geographical location.
Currently am able to capture all the mails (
OnDelivery()
method of IExchExtSessionEvents) .How to save this mails in .MSG
format
with
UNICODE support?
I wonder whether am proceeding in the right direction in my quest
to
design
the above mentioned utilty!
1. How can I save the incoming mail in .MSG format with UNICODE
support.
Note: I can trap the incoming mail. How to save this mail
with
.msg
format
and with unicode support.
2. Can I restore mails if I save mails in .msg with unicode
support.
Seeking your guidance
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
What kind of backup? *Where* do you want to store the messages?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
I love you Dmitry. Really you are giving lot of help.
Anyway, I have to take backup of all incoming mails and
restore
all
mails
when user asks. this is very primary step of my project.
Thank you for giving immediate reply.
Thanks in advance.
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Post by Dmitry Streblechenko
You mean you have an Exchange Client Extension, not a COM
add-in,
right?
What kind of backup do you have in mind? Outlook folder?
DB?
MSG
file?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft
Outlook. I
am
trying to
take backup of all incoming mails. I overridden
OnDelivery
method
of
IExchExtSessionEvents interface. I can trap all
incoming
mails.
But
how
can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know
MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Dkds.Naidu
2005-08-24 05:49:01 UTC
Permalink
Hi Dmitry,

Yes. It corrupts. After set PR_SUBJECT_W property to pIBackupMsg, it
corrupts(ie. replaced with question marks only). I am giving code
snippet.Give me suggestions.

code snippet:

LPSPropValue IncomingMailSubj;

HrGetOneProp(pOriginalMessage,PR_SUBJECT_W,&IncomingMailSubj);
MessageBoxW(NULL,IncomingMailSubj->Value.lpszW,L"",MB_OK);//Correct value

SPropValue setValToBackupMail;
setValToBackupMail.ulPropTag = PR_SUBJECT_W;
setValToBackupMail.Value.lpszW = IncomingMailSubj->Value.lpszW;
MessageBoxW(NULL,setValToBackupMail.Value.lpszW,L"",MB_OK);//Correct value

HrSetOneProp(pBackupIMsg,&setValToBackupMail);

LPSPropValue BackupMailSubject;
HrGetOneProp(pBackupIMsg,PR_SUBJECT_W,&BackupMailSubject);
MessageBoxW(NULL,BackupMailSubject->Value.lpszW,L"",MB_OK);//Corrupted for
non-english mails.


Thanks in advance.


With regards,
--
DKDS.Naidu,
Post by Dmitry Streblechenko
Do you mean you display PR_SUBJECT_W before setting it on pBackupIMsg, set
it, then read it back from pBackupIMsg and display it again, you get the
expected value in both cases?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
Thank you for your response.
After setting subject,it doesnt have any problems. It works fine.
attachments, body, large number of reciepients, etc all are working fine
except SUBJECT.
How can I provide UNICODE support through programmatically?
I saved each mail as a .MSG format only. I have to take .MSG with UNICODE
support. But I am missing UNICODE support. U can check this problem with
saveas menuitem of FILE menu of OUTLOOK. While doing saveas of OUTLOOK mail
with .MSG only(without UNICODE support), it lose subject if it has UNICODE
characters otherwise it works fine.
Thanks in advance,
With regards,
--
DKDS.Naidu,
Post by Dmitry Streblechenko
What happens if you try to read PR_SUBJECT_W from pBackupIMsg immediately
after setting it?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
Yes. MessageBoxW displays correct value.
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
So does the message box display the correct value?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
I tried with the following code snippet. But problem is
there.
How
can I fix it?
LPSPropValue value;
HrGetOneProp(lpIncomingMessage,PR_SUBJECT_W,&value);
MessageBoxW(NULL,value->Value.lpszW,L"",MB_OK);
SPropValue setVal;
setVal.ulPropTag = PR_SUBJECT_W;
setVal.Value.lpszW = value->Value.lpszW;
MessageBoxW(NULL,setVal.Value.lpszW,L"",MB_OK);
HrSetOneProp(pBackupIMsg,&setVal);
I tried with
CComVariant myFolder(DISP_E_PARAMNOTFOUND, VT_ERROR);
CComPtr<Outlook::_MailItem> olRestoreMail;
spApp->CreateItemFromTemplate("C:\\backup.msg",myFolder,(IDispatch**)&olRestoreMail);
But its not downloaded into my account. How to solve this problem?
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
Can you retrieve PR_SUBJECT using HrGetOneProp?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
According to your suggestion, I followed MICROSOFT Q171907
article.
It
works fine except SUBJECT property. But, Backup mails lose SUBJECT
only
if
SUBJECT has non-english characters, otherwise it works fine.
How can I solve this problem?
How can I read .MSG files? (ie, how to download .MSG files into
current
pst?)
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
I have to disagree: you will have problems with any format. MIME
might
be
a
good alternative, but it poses even greater conversion problems,
especially
with the MAPI specific features, such as pure RTF messages,
embedded
OLE
attachments, etc.
You can of course develop your own format, but I suspect that it
will
take
you months to design and debug it to bring the number of bugs down
to
the
level that you will encounter with the MSG format.
The biggest MSG format problem is the messages with a large # of
recipients,
but it easy to work around it by ussing StgCreateStorageEx (Windows
2000
and
up) rather than StgCreateDocfile.
Q171907 has sample code that shows how to save a message in the MSG
http://support.microsoft.com/?kbid=171907
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Stephen Griffin
I would NOT use MSG as a means for message archiving/backup. This
message
format is not suitable for storing all the variety of messages
you
will
encounter in the wild. In particular, deeply nested messages and
messages
with large numbers of recipients and/or attachments will present
unsolvable
problems with this format. Also, you lose a great deal in message
fidelity
in conversion to and from this format.
You will be much better off developing your own format in which
to
archive
the messages, or (since it looks like this may be an in-house
project),
locating a third party who has already done this work.
Steve
Post by Dkds.Naidu
Hi Dmitry,
I am trying to design a utilty in Outlook where
the
user
is
given the provision of saving a copy of the every incoming
mail
in
a
desired
location (currently in our server).
This utility will enable the user to
resore/downlaod
his
mails
from the server once the user moves from his current place to
a
different
geographical location.
Currently am able to capture all the mails (
OnDelivery()
method of IExchExtSessionEvents) .How to save this mails in
.MSG
format
with
UNICODE support?
I wonder whether am proceeding in the right direction in my
quest
to
design
the above mentioned utilty!
1. How can I save the incoming mail in .MSG format with
UNICODE
support.
Note: I can trap the incoming mail. How to save this mail
with
.msg
format
and with unicode support.
2. Can I restore mails if I save mails in .msg with unicode
support.
Seeking your guidance
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
What kind of backup? *Where* do you want to store the
messages?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
I love you Dmitry. Really you are giving lot of help.
Anyway, I have to take backup of all incoming mails and
restore
all
mails
when user asks. this is very primary step of my project.
Thank you for giving immediate reply.
Thanks in advance.
--
DKDS.Naidu,
Dmitry Streblechenko
2005-08-24 16:58:53 UTC
Permalink
Then your only option is to set the PR_INTERNET_CPID on pIBackupMsg, convert
the Unicode subject to a multibyte string using WideCharToMultibyte and set
PR_SUBJECT_A to that converted string.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
Yes. It corrupts. After set PR_SUBJECT_W property to pIBackupMsg, it
corrupts(ie. replaced with question marks only). I am giving code
snippet.Give me suggestions.
LPSPropValue IncomingMailSubj;
HrGetOneProp(pOriginalMessage,PR_SUBJECT_W,&IncomingMailSubj);
MessageBoxW(NULL,IncomingMailSubj->Value.lpszW,L"",MB_OK);//Correct value
SPropValue setValToBackupMail;
setValToBackupMail.ulPropTag = PR_SUBJECT_W;
setValToBackupMail.Value.lpszW = IncomingMailSubj->Value.lpszW;
MessageBoxW(NULL,setValToBackupMail.Value.lpszW,L"",MB_OK);//Correct value
HrSetOneProp(pBackupIMsg,&setValToBackupMail);
LPSPropValue BackupMailSubject;
HrGetOneProp(pBackupIMsg,PR_SUBJECT_W,&BackupMailSubject);
MessageBoxW(NULL,BackupMailSubject->Value.lpszW,L"",MB_OK);//Corrupted for
non-english mails.
Thanks in advance.
With regards,
--
DKDS.Naidu,
Post by Dmitry Streblechenko
Do you mean you display PR_SUBJECT_W before setting it on pBackupIMsg, set
it, then read it back from pBackupIMsg and display it again, you get the
expected value in both cases?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
Thank you for your response.
After setting subject,it doesnt have any problems. It works fine.
attachments, body, large number of reciepients, etc all are working fine
except SUBJECT.
How can I provide UNICODE support through programmatically?
I saved each mail as a .MSG format only. I have to take .MSG with UNICODE
support. But I am missing UNICODE support. U can check this problem with
saveas menuitem of FILE menu of OUTLOOK. While doing saveas of OUTLOOK mail
with .MSG only(without UNICODE support), it lose subject if it has UNICODE
characters otherwise it works fine.
Thanks in advance,
With regards,
--
DKDS.Naidu,
Post by Dmitry Streblechenko
What happens if you try to read PR_SUBJECT_W from pBackupIMsg immediately
after setting it?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
Yes. MessageBoxW displays correct value.
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
So does the message box display the correct value?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
I tried with the following code snippet. But problem is
there.
How
can I fix it?
LPSPropValue value;
HrGetOneProp(lpIncomingMessage,PR_SUBJECT_W,&value);
MessageBoxW(NULL,value->Value.lpszW,L"",MB_OK);
SPropValue setVal;
setVal.ulPropTag = PR_SUBJECT_W;
setVal.Value.lpszW = value->Value.lpszW;
MessageBoxW(NULL,setVal.Value.lpszW,L"",MB_OK);
HrSetOneProp(pBackupIMsg,&setVal);
I tried with
CComVariant myFolder(DISP_E_PARAMNOTFOUND, VT_ERROR);
CComPtr<Outlook::_MailItem> olRestoreMail;
spApp->CreateItemFromTemplate("C:\\backup.msg",myFolder,(IDispatch**)&olRestoreMail);
But its not downloaded into my account. How to solve this problem?
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
Can you retrieve PR_SUBJECT using HrGetOneProp?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
According to your suggestion, I followed MICROSOFT Q171907
article.
It
works fine except SUBJECT property. But, Backup mails lose SUBJECT
only
if
SUBJECT has non-english characters, otherwise it works fine.
How can I solve this problem?
How can I read .MSG files? (ie, how to download .MSG files into
current
pst?)
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
I have to disagree: you will have problems with any format. MIME
might
be
a
good alternative, but it poses even greater conversion problems,
especially
with the MAPI specific features, such as pure RTF messages,
embedded
OLE
attachments, etc.
You can of course develop your own format, but I suspect that it
will
take
you months to design and debug it to bring the number of bugs
down
to
the
level that you will encounter with the MSG format.
The biggest MSG format problem is the messages with a large # of
recipients,
but it easy to work around it by ussing StgCreateStorageEx
(Windows
2000
and
up) rather than StgCreateDocfile.
Q171907 has sample code that shows how to save a message in
the
MSG
http://support.microsoft.com/?kbid=171907
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Stephen Griffin
I would NOT use MSG as a means for message archiving/backup.
This
message
format is not suitable for storing all the variety of messages
you
will
encounter in the wild. In particular, deeply nested messages
and
messages
with large numbers of recipients and/or attachments will
present
unsolvable
problems with this format. Also, you lose a great deal in
message
fidelity
in conversion to and from this format.
You will be much better off developing your own format in
which
to
archive
the messages, or (since it looks like this may be an in-house
project),
locating a third party who has already done this work.
Steve
Post by Dkds.Naidu
Hi Dmitry,
I am trying to design a utilty in Outlook where
the
user
is
given the provision of saving a copy of the every incoming
mail
in
a
desired
location (currently in our server).
This utility will enable the user to
resore/downlaod
his
mails
from the server once the user moves from his current place
to
a
different
geographical location.
Currently am able to capture all the mails (
OnDelivery()
method of IExchExtSessionEvents) .How to save this mails in
.MSG
format
with
UNICODE support?
I wonder whether am proceeding in the right direction in my
quest
to
design
the above mentioned utilty!
1. How can I save the incoming mail in .MSG format with
UNICODE
support.
Note: I can trap the incoming mail. How to save this mail
with
.msg
format
and with unicode support.
2. Can I restore mails if I save mails in .msg with unicode
support.
Seeking your guidance
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
What kind of backup? *Where* do you want to store the
messages?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
I love you Dmitry. Really you are giving lot of help.
Anyway, I have to take backup of all incoming mails
and
restore
all
mails
when user asks. this is very primary step of my
project.
Thank you for giving immediate reply.
Thanks in advance.
--
DKDS.Naidu,
Dkds.Naidu
2005-08-30 15:34:24 UTC
Permalink
Hi Dmitry,

I followed http://support.microsoft.com/?kbid=171907 article.
I can take backup of all incoming mails through programmatically.I can do
backup and restore of hundreds of mails. Really, it works fine. But, after
creating setup of our application which is fails at lpMessage->CopyTo(......)
function everytime. How can I solve this problem? after creating setup only,
it has this problem.

Thanks in advance.

With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
I have to disagree: you will have problems with any format. MIME might be a
good alternative, but it poses even greater conversion problems, especially
with the MAPI specific features, such as pure RTF messages, embedded OLE
attachments, etc.
You can of course develop your own format, but I suspect that it will take
you months to design and debug it to bring the number of bugs down to the
level that you will encounter with the MSG format.
The biggest MSG format problem is the messages with a large # of recipients,
but it easy to work around it by ussing StgCreateStorageEx (Windows 2000 and
up) rather than StgCreateDocfile.
http://support.microsoft.com/?kbid=171907
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Stephen Griffin
I would NOT use MSG as a means for message archiving/backup. This message
format is not suitable for storing all the variety of messages you will
encounter in the wild. In particular, deeply nested messages and messages
with large numbers of recipients and/or attachments will present unsolvable
problems with this format. Also, you lose a great deal in message fidelity
in conversion to and from this format.
You will be much better off developing your own format in which to archive
the messages, or (since it looks like this may be an in-house project),
locating a third party who has already done this work.
Steve
Post by Dkds.Naidu
Hi Dmitry,
I am trying to design a utilty in Outlook where the user is
given the provision of saving a copy of the every incoming mail in a desired
location (currently in our server).
This utility will enable the user to resore/downlaod his mails
from the server once the user moves from his current place to a different
geographical location.
Currently am able to capture all the mails ( OnDelivery()
method of IExchExtSessionEvents) .How to save this mails in .MSG format with
UNICODE support?
I wonder whether am proceeding in the right direction in my quest to design
the above mentioned utilty!
1. How can I save the incoming mail in .MSG format with UNICODE support.
Note: I can trap the incoming mail. How to save this mail with .msg format
and with unicode support.
2. Can I restore mails if I save mails in .msg with unicode support.
Seeking your guidance
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
What kind of backup? *Where* do you want to store the messages?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
I love you Dmitry. Really you are giving lot of help.
Anyway, I have to take backup of all incoming mails and restore all mails
when user asks. this is very primary step of my project.
Thank you for giving immediate reply.
Thanks in advance.
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Post by Dmitry Streblechenko
You mean you have an Exchange Client Extension, not a COM add-in, right?
What kind of backup do you have in mind? Outlook folder? DB? MSG file?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am trying to
take backup of all incoming mails. I overridden OnDelivery method of
IExchExtSessionEvents interface. I can trap all incoming mails. But
how
can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Dmitry Streblechenko
2005-08-30 17:22:51 UTC
Permalink
What is the error returned by CopyTo()?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
I followed http://support.microsoft.com/?kbid=171907 article.
I can take backup of all incoming mails through programmatically.I can do
backup and restore of hundreds of mails. Really, it works fine. But, after
creating setup of our application which is fails at
lpMessage->CopyTo(......)
function everytime. How can I solve this problem? after creating setup only,
it has this problem.
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
I have to disagree: you will have problems with any format. MIME might be a
good alternative, but it poses even greater conversion problems, especially
with the MAPI specific features, such as pure RTF messages, embedded OLE
attachments, etc.
You can of course develop your own format, but I suspect that it will take
you months to design and debug it to bring the number of bugs down to the
level that you will encounter with the MSG format.
The biggest MSG format problem is the messages with a large # of recipients,
but it easy to work around it by ussing StgCreateStorageEx (Windows 2000 and
up) rather than StgCreateDocfile.
http://support.microsoft.com/?kbid=171907
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Stephen Griffin
I would NOT use MSG as a means for message archiving/backup. This message
format is not suitable for storing all the variety of messages you will
encounter in the wild. In particular, deeply nested messages and messages
with large numbers of recipients and/or attachments will present unsolvable
problems with this format. Also, you lose a great deal in message fidelity
in conversion to and from this format.
You will be much better off developing your own format in which to archive
the messages, or (since it looks like this may be an in-house project),
locating a third party who has already done this work.
Steve
Post by Dkds.Naidu
Hi Dmitry,
I am trying to design a utilty in Outlook where the user is
given the provision of saving a copy of the every incoming mail in a desired
location (currently in our server).
This utility will enable the user to resore/downlaod his mails
from the server once the user moves from his current place to a different
geographical location.
Currently am able to capture all the mails (
OnDelivery()
method of IExchExtSessionEvents) .How to save this mails in .MSG
format
with
UNICODE support?
I wonder whether am proceeding in the right direction in my quest to design
the above mentioned utilty!
1. How can I save the incoming mail in .MSG format with UNICODE support.
Note: I can trap the incoming mail. How to save this mail with .msg format
and with unicode support.
2. Can I restore mails if I save mails in .msg with unicode support.
Seeking your guidance
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
What kind of backup? *Where* do you want to store the messages?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
I love you Dmitry. Really you are giving lot of help.
Anyway, I have to take backup of all incoming mails and restore
all
mails
when user asks. this is very primary step of my project.
Thank you for giving immediate reply.
Thanks in advance.
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Post by Dmitry Streblechenko
You mean you have an Exchange Client Extension, not a COM add-in, right?
What kind of backup do you have in mind? Outlook folder? DB? MSG file?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am trying to
take backup of all incoming mails. I overridden OnDelivery
method
of
IExchExtSessionEvents interface. I can trap all incoming mails. But
how
can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Dkds.Naidu
2005-08-31 05:09:02 UTC
Permalink
Thank you for your immediate response.

Application crashed where copying properties from one message to another
message.


char chFilePath[500];
HRESULT hRes = S_OK;
LPSPropValue pSubject = NULL;
CComPtr<IStorage> pStorage;
LPMSGSESS pMsgSession = NULL;
LPMESSAGE pIBackupMsg = NULL;
LPWSTR lpWideCharStr = NULL;
ULONG cbStrSize = 0L;
SizedSPropTagArray ( 7, excludeTags );

//Got the complete file path into "chFilePath"
lpWideCharStr = A2W(chFilePath);
LPMALLOC pMalloc = MAPIGetDefaultMalloc();
hRes = ::StgCreateDocfile(lpWideCharStr,STGM_READWRITE |STGM_TRANSACTED
|STGM_CREATE, 0, &pStorage);

hRes = ::StgCreateStorageEx(lpWideCharStr,STGM_READWRITE |STGM_TRANSACTED
|STGM_CREATE,STGFMT_STORAGE,0,
NULL,NULL,IID_IStorage,reinterpret_cast<void**>(&pStorage));

hRes = ::OpenIMsgSession(pMalloc, 0, &pMsgSession);

hRes =
::OpenIMsgOnIStg(pMsgSession,MAPIAllocateBuffer,MAPIAllocateMore,MAPIFreeBuffer,pMalloc,NULL,pStorage,NULL, 0, 0, &pIMsg);

hRes = WriteClassStg(pStorage, CLSID_MailMessage );

excludeTags.cValues = 7;
excludeTags.aulPropTag[0] = PR_ACCESS;
excludeTags.aulPropTag[1] = PR_BODY;
excludeTags.aulPropTag[2] = PR_RTF_SYNC_BODY_COUNT;
excludeTags.aulPropTag[3] = PR_RTF_SYNC_BODY_CRC;
excludeTags.aulPropTag[4] = PR_RTF_SYNC_BODY_TAG;
excludeTags.aulPropTag[5] = PR_RTF_SYNC_PREFIX_COUNT;
excludeTags.aulPropTag[6] = PR_RTF_SYNC_TRAILING_COUNT;

hRes = lpOriginalMessage -> CopyTo(0,
NULL,(LPSPropTagArray)&excludeTags,NULL,
NULL,(LPIID)&IID_IMessage,pIBackupMsg, 0, NULL );
/**************************************/
When copying properties from lpOriginalMessage to pIBackupMsg, Outlook gets
crash problem.I tried with excludeTags parameter and without excludeTags
parameter(ie. NULL).
/**************************************/


Thanks in advance.

With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
What is the error returned by CopyTo()?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
I followed http://support.microsoft.com/?kbid=171907 article.
I can take backup of all incoming mails through programmatically.I can do
backup and restore of hundreds of mails. Really, it works fine. But, after
creating setup of our application which is fails at
lpMessage->CopyTo(......)
function everytime. How can I solve this problem? after creating setup only,
it has this problem.
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
I have to disagree: you will have problems with any format. MIME might be a
good alternative, but it poses even greater conversion problems, especially
with the MAPI specific features, such as pure RTF messages, embedded OLE
attachments, etc.
You can of course develop your own format, but I suspect that it will take
you months to design and debug it to bring the number of bugs down to the
level that you will encounter with the MSG format.
The biggest MSG format problem is the messages with a large # of recipients,
but it easy to work around it by ussing StgCreateStorageEx (Windows 2000 and
up) rather than StgCreateDocfile.
http://support.microsoft.com/?kbid=171907
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Stephen Griffin
I would NOT use MSG as a means for message archiving/backup. This message
format is not suitable for storing all the variety of messages you will
encounter in the wild. In particular, deeply nested messages and messages
with large numbers of recipients and/or attachments will present unsolvable
problems with this format. Also, you lose a great deal in message fidelity
in conversion to and from this format.
You will be much better off developing your own format in which to archive
the messages, or (since it looks like this may be an in-house project),
locating a third party who has already done this work.
Steve
Post by Dkds.Naidu
Hi Dmitry,
I am trying to design a utilty in Outlook where the user is
given the provision of saving a copy of the every incoming mail in a desired
location (currently in our server).
This utility will enable the user to resore/downlaod his mails
from the server once the user moves from his current place to a different
geographical location.
Currently am able to capture all the mails ( OnDelivery()
method of IExchExtSessionEvents) .How to save this mails in .MSG
format
with
UNICODE support?
I wonder whether am proceeding in the right direction in my quest to design
the above mentioned utilty!
1. How can I save the incoming mail in .MSG format with UNICODE support.
Note: I can trap the incoming mail. How to save this mail with .msg format
and with unicode support.
2. Can I restore mails if I save mails in .msg with unicode support.
Seeking your guidance
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
What kind of backup? *Where* do you want to store the messages?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
I love you Dmitry. Really you are giving lot of help.
Anyway, I have to take backup of all incoming mails and restore
all
mails
when user asks. this is very primary step of my project.
Thank you for giving immediate reply.
Thanks in advance.
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Post by Dmitry Streblechenko
You mean you have an Exchange Client Extension, not a COM add-in,
right?
What kind of backup do you have in mind? Outlook folder? DB? MSG file?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am
trying to
take backup of all incoming mails. I overridden OnDelivery
method
of
IExchExtSessionEvents interface. I can trap all incoming mails. But
how
can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Dmitry Streblechenko
2005-08-31 05:16:24 UTC
Permalink
IMessage on IStorage is returned in the pIMsg variable by OpenIMsgOnIStg(),
but you are using the pIBackupMsg variable when calling CopyTo().

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Thank you for your immediate response.
Application crashed where copying properties from one message to another
message.
char chFilePath[500];
HRESULT hRes = S_OK;
LPSPropValue pSubject = NULL;
CComPtr<IStorage> pStorage;
LPMSGSESS pMsgSession = NULL;
LPMESSAGE pIBackupMsg = NULL;
LPWSTR lpWideCharStr = NULL;
ULONG cbStrSize = 0L;
SizedSPropTagArray ( 7, excludeTags );
//Got the complete file path into "chFilePath"
lpWideCharStr = A2W(chFilePath);
LPMALLOC pMalloc = MAPIGetDefaultMalloc();
hRes = ::StgCreateDocfile(lpWideCharStr,STGM_READWRITE |STGM_TRANSACTED
|STGM_CREATE, 0, &pStorage);
hRes = ::StgCreateStorageEx(lpWideCharStr,STGM_READWRITE |STGM_TRANSACTED
|STGM_CREATE,STGFMT_STORAGE,0,
NULL,NULL,IID_IStorage,reinterpret_cast<void**>(&pStorage));
hRes = ::OpenIMsgSession(pMalloc, 0, &pMsgSession);
hRes =
::OpenIMsgOnIStg(pMsgSession,MAPIAllocateBuffer,MAPIAllocateMore,MAPIFreeBuffer,pMalloc,NULL,pStorage,NULL,
0, 0, &pIMsg);
hRes = WriteClassStg(pStorage, CLSID_MailMessage );
excludeTags.cValues = 7;
excludeTags.aulPropTag[0] = PR_ACCESS;
excludeTags.aulPropTag[1] = PR_BODY;
excludeTags.aulPropTag[2] = PR_RTF_SYNC_BODY_COUNT;
excludeTags.aulPropTag[3] = PR_RTF_SYNC_BODY_CRC;
excludeTags.aulPropTag[4] = PR_RTF_SYNC_BODY_TAG;
excludeTags.aulPropTag[5] = PR_RTF_SYNC_PREFIX_COUNT;
excludeTags.aulPropTag[6] = PR_RTF_SYNC_TRAILING_COUNT;
hRes = lpOriginalMessage -> CopyTo(0,
NULL,(LPSPropTagArray)&excludeTags,NULL,
NULL,(LPIID)&IID_IMessage,pIBackupMsg, 0, NULL );
/**************************************/
When copying properties from lpOriginalMessage to pIBackupMsg, Outlook gets
crash problem.I tried with excludeTags parameter and without excludeTags
parameter(ie. NULL).
/**************************************/
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
What is the error returned by CopyTo()?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
I followed http://support.microsoft.com/?kbid=171907 article.
I can take backup of all incoming mails through programmatically.I can do
backup and restore of hundreds of mails. Really, it works fine. But, after
creating setup of our application which is fails at
lpMessage->CopyTo(......)
function everytime. How can I solve this problem? after creating setup only,
it has this problem.
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
I have to disagree: you will have problems with any format. MIME might
be
a
good alternative, but it poses even greater conversion problems, especially
with the MAPI specific features, such as pure RTF messages, embedded OLE
attachments, etc.
You can of course develop your own format, but I suspect that it will take
you months to design and debug it to bring the number of bugs down to the
level that you will encounter with the MSG format.
The biggest MSG format problem is the messages with a large # of recipients,
but it easy to work around it by ussing StgCreateStorageEx (Windows
2000
and
up) rather than StgCreateDocfile.
http://support.microsoft.com/?kbid=171907
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Stephen Griffin
I would NOT use MSG as a means for message archiving/backup. This message
format is not suitable for storing all the variety of messages you will
encounter in the wild. In particular, deeply nested messages and messages
with large numbers of recipients and/or attachments will present unsolvable
problems with this format. Also, you lose a great deal in message fidelity
in conversion to and from this format.
You will be much better off developing your own format in which to archive
the messages, or (since it looks like this may be an in-house project),
locating a third party who has already done this work.
Steve
Post by Dkds.Naidu
Hi Dmitry,
I am trying to design a utilty in Outlook where the
user
is
given the provision of saving a copy of the every incoming mail in
a
desired
location (currently in our server).
This utility will enable the user to resore/downlaod
his
mails
from the server once the user moves from his current place to a different
geographical location.
Currently am able to capture all the mails ( OnDelivery()
method of IExchExtSessionEvents) .How to save this mails in .MSG
format
with
UNICODE support?
I wonder whether am proceeding in the right direction in my quest
to
design
the above mentioned utilty!
1. How can I save the incoming mail in .MSG format with UNICODE support.
Note: I can trap the incoming mail. How to save this mail with .msg format
and with unicode support.
2. Can I restore mails if I save mails in .msg with unicode support.
Seeking your guidance
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
What kind of backup? *Where* do you want to store the messages?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
I love you Dmitry. Really you are giving lot of help.
Anyway, I have to take backup of all incoming mails and restore
all
mails
when user asks. this is very primary step of my project.
Thank you for giving immediate reply.
Thanks in advance.
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Post by Dmitry Streblechenko
You mean you have an Exchange Client Extension, not a COM add-in,
right?
What kind of backup do you have in mind? Outlook folder? DB?
MSG
file?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am
trying to
take backup of all incoming mails. I overridden OnDelivery
method
of
IExchExtSessionEvents interface. I can trap all incoming
mails.
But
how
can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Dkds.Naidu
2005-08-31 06:15:03 UTC
Permalink
Thank you for your response. sorry for the last post.

While developing application, it works fine.I got more than 500 mails
backup.Then, I created setup for this application.Now, it has crash problems
while copying properties. With setup, I can create .msg file with 0 bytes
only and it is getting crash.


STDMETHODIMP
CExchangeAddin::OnDelivery(IExchExtCallback *lpExchangeCallback)
{
LPMESSAGE lpMessage = NULL;
LPMDB lpMdb = NULL;
if (SUCCEEDED(lpExchangeCallback->GetObject(&lpMdb, (LPMAPIPROP*)&lpMessage)))
{
char chFilePath[500];
HRESULT hRes = S_OK;
LPSPropValue pSubject = NULL;
CComPtr<IStorage> pStorage;
LPMSGSESS pMsgSession = NULL;
LPMESSAGE pIMsg = NULL;
LPWSTR lpWideCharStr = NULL;
ULONG cbStrSize = 0L;
SizedSPropTagArray ( 7, excludeTags );
USES_CONVERSION;


//Got the complete file path into "chFilePath"
lpWideCharStr = A2W(chFilePath);
LPMALLOC pMalloc = MAPIGetDefaultMalloc();
hRes = ::StgCreateDocfile(lpWideCharStr,STGM_READWRITE |STGM_TRANSACTED
|STGM_CREATE, 0, &pStorage);

hRes = ::StgCreateStorageEx(lpWideCharStr,STGM_READWRITE |STGM_TRANSACTED
|STGM_CREATE,STGFMT_STORAGE,0,
NULL,NULL,IID_IStorage,reinterpret_cast<void**>(&pStorage));

hRes = ::OpenIMsgSession(pMalloc, 0, &pMsgSession);

hRes =
::OpenIMsgOnIStg(pMsgSession,MAPIAllocateBuffer,MAPIAllocateMore,MAPIFreeBuffer,pMalloc,NULL,pStorage,NULL, 0, 0, &pIMsg);

hRes = WriteClassStg(pStorage, CLSID_MailMessage );

excludeTags.cValues = 7;
excludeTags.aulPropTag[0] = PR_ACCESS;
excludeTags.aulPropTag[1] = PR_BODY;
excludeTags.aulPropTag[2] = PR_RTF_SYNC_BODY_COUNT;
excludeTags.aulPropTag[3] = PR_RTF_SYNC_BODY_CRC;
excludeTags.aulPropTag[4] = PR_RTF_SYNC_BODY_TAG;
excludeTags.aulPropTag[5] = PR_RTF_SYNC_PREFIX_COUNT;
excludeTags.aulPropTag[6] = PR_RTF_SYNC_TRAILING_COUNT;

hRes = lpMessage -> CopyTo(0,
NULL,(LPSPropTagArray)&excludeTags,NULL,
NULL,(LPIID)&IID_IMessage,pIMsg, 0, NULL );
/**************************************/
When copying properties from lpMessage to pIMsg, Outlook gets
crash problem.I tried with excludeTags parameter and without excludeTags
parameter(ie. NULL).
/**************************************/

}

}

Thanks in advance.

With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
IMessage on IStorage is returned in the pIMsg variable by OpenIMsgOnIStg(),
but you are using the pIBackupMsg variable when calling CopyTo().
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Thank you for your immediate response.
Application crashed where copying properties from one message to another
message.
char chFilePath[500];
HRESULT hRes = S_OK;
LPSPropValue pSubject = NULL;
CComPtr<IStorage> pStorage;
LPMSGSESS pMsgSession = NULL;
LPMESSAGE pIBackupMsg = NULL;
LPWSTR lpWideCharStr = NULL;
ULONG cbStrSize = 0L;
SizedSPropTagArray ( 7, excludeTags );
//Got the complete file path into "chFilePath"
lpWideCharStr = A2W(chFilePath);
LPMALLOC pMalloc = MAPIGetDefaultMalloc();
hRes = ::StgCreateDocfile(lpWideCharStr,STGM_READWRITE |STGM_TRANSACTED
|STGM_CREATE, 0, &pStorage);
hRes = ::StgCreateStorageEx(lpWideCharStr,STGM_READWRITE |STGM_TRANSACTED
|STGM_CREATE,STGFMT_STORAGE,0,
NULL,NULL,IID_IStorage,reinterpret_cast<void**>(&pStorage));
hRes = ::OpenIMsgSession(pMalloc, 0, &pMsgSession);
hRes =
::OpenIMsgOnIStg(pMsgSession,MAPIAllocateBuffer,MAPIAllocateMore,MAPIFreeBuffer,pMalloc,NULL,pStorage,NULL,
0, 0, &pIMsg);
hRes = WriteClassStg(pStorage, CLSID_MailMessage );
excludeTags.cValues = 7;
excludeTags.aulPropTag[0] = PR_ACCESS;
excludeTags.aulPropTag[1] = PR_BODY;
excludeTags.aulPropTag[2] = PR_RTF_SYNC_BODY_COUNT;
excludeTags.aulPropTag[3] = PR_RTF_SYNC_BODY_CRC;
excludeTags.aulPropTag[4] = PR_RTF_SYNC_BODY_TAG;
excludeTags.aulPropTag[5] = PR_RTF_SYNC_PREFIX_COUNT;
excludeTags.aulPropTag[6] = PR_RTF_SYNC_TRAILING_COUNT;
hRes = lpOriginalMessage -> CopyTo(0,
NULL,(LPSPropTagArray)&excludeTags,NULL,
NULL,(LPIID)&IID_IMessage,pIBackupMsg, 0, NULL );
/**************************************/
When copying properties from lpOriginalMessage to pIBackupMsg, Outlook gets
crash problem.I tried with excludeTags parameter and without excludeTags
parameter(ie. NULL).
/**************************************/
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
What is the error returned by CopyTo()?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
I followed http://support.microsoft.com/?kbid=171907 article.
I can take backup of all incoming mails through programmatically.I can do
backup and restore of hundreds of mails. Really, it works fine. But, after
creating setup of our application which is fails at
lpMessage->CopyTo(......)
function everytime. How can I solve this problem? after creating setup only,
it has this problem.
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
I have to disagree: you will have problems with any format. MIME might
be
a
good alternative, but it poses even greater conversion problems, especially
with the MAPI specific features, such as pure RTF messages, embedded OLE
attachments, etc.
You can of course develop your own format, but I suspect that it will take
you months to design and debug it to bring the number of bugs down to the
level that you will encounter with the MSG format.
The biggest MSG format problem is the messages with a large # of recipients,
but it easy to work around it by ussing StgCreateStorageEx (Windows
2000
and
up) rather than StgCreateDocfile.
http://support.microsoft.com/?kbid=171907
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Stephen Griffin
I would NOT use MSG as a means for message archiving/backup. This message
format is not suitable for storing all the variety of messages you will
encounter in the wild. In particular, deeply nested messages and messages
with large numbers of recipients and/or attachments will present unsolvable
problems with this format. Also, you lose a great deal in message fidelity
in conversion to and from this format.
You will be much better off developing your own format in which to archive
the messages, or (since it looks like this may be an in-house project),
locating a third party who has already done this work.
Steve
Post by Dkds.Naidu
Hi Dmitry,
I am trying to design a utilty in Outlook where the
user
is
given the provision of saving a copy of the every incoming mail in
a
desired
location (currently in our server).
This utility will enable the user to resore/downlaod
his
mails
from the server once the user moves from his current place to a different
geographical location.
Currently am able to capture all the mails ( OnDelivery()
method of IExchExtSessionEvents) .How to save this mails in .MSG
format
with
UNICODE support?
I wonder whether am proceeding in the right direction in my quest
to
design
the above mentioned utilty!
1. How can I save the incoming mail in .MSG format with UNICODE support.
Note: I can trap the incoming mail. How to save this mail with .msg
format
and with unicode support.
2. Can I restore mails if I save mails in .msg with unicode support.
Seeking your guidance
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
What kind of backup? *Where* do you want to store the messages?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
I love you Dmitry. Really you are giving lot of help.
Anyway, I have to take backup of all incoming mails and restore
all
mails
when user asks. this is very primary step of my project.
Thank you for giving immediate reply.
Thanks in advance.
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Post by Dmitry Streblechenko
You mean you have an Exchange Client Extension, not a COM add-in,
right?
What kind of backup do you have in mind? Outlook folder? DB?
MSG
file?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am
trying to
take backup of all incoming mails. I overridden OnDelivery
method
of
IExchExtSessionEvents interface. I can trap all incoming
mails.
But
how
can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Dkds.Naidu
2005-08-31 07:23:01 UTC
Permalink
Just now, I tried with below code snippet. It behaves differently. I have
taken LPSPropProblemArray.

LPSPropProblemArray pProblems;
try{
MessageBox(NULL,"Trying to copy properties","",MB_OK);//I got this messagebox
hRes = lpMessage -> CopyTo(0, NULL,(LPSPropTagArray)&excludeTags,NULL,
NULL,(LPIID)&IID_IMessage,pIMsg, 0, &pProblems);
MessageBox(NULL,"copied properties","",MB_OK);//I got this messagebox
}catch(...)
{
MessageBox(NULL,"catch block","",MB_OK);
}


if (hRes == S_OK )
MessageBox(NULL,"S_OK ","",MB_OK);
if (hRes == MAPI_E_COLLISION )
MessageBox(NULL,"MAPI_E_COLLISION ","",MB_OK);
if (hRes == MAPI_E_DECLINE_COPY )
MessageBox(NULL,"MAPI_E_DECLINE_COPY ","",MB_OK);
if (hRes == MAPI_E_FOLDER_CYCLE )
MessageBox(NULL,"MAPI_E_FOLDER_CYCLE ","",MB_OK);
if (hRes == MAPI_E_INTERFACE_NOT_SUPPORTED )
MessageBox(NULL,"MAPI_E_INTERFACE_NOT_SUPPORTED ","",MB_OK);
if (hRes == MAPI_E_NO_ACCESS)
MessageBox(NULL,"MAPI_E_NO_ACCESS ","",MB_OK);
if (hRes == S_FALSE)
MessageBox(NULL,"S_FALSE","",MB_OK);

if (SUCCEEDED(hRes)) MessageBox(NULL,"copyto succ","",MB_OK);
else
{
MessageBox(NULL,"copyto fail","",MB_OK);//I got this messagebox
if (pProblems != NULL)
{
int nNoOfStructures = pProblems->cProblem;
FILE* fp = fopen("C:\\Problems.txt","a+");
fprintf(fp,"No Of Problems:: %d\n\n",nNoOfStructures);
fclose(fp);
for (int i = 1; i <= nNoOfStructures; i ++)
{
FILE* fp = fopen("C:\\Problems.txt","a+");
fprintf(fp,"%d\t%d\t%d\n",pProblems->aProblem->ulIndex,pProblems->aProblem->ulPropTag,pProblems->aProblem->scode);
fclose(fp);
}
return S_FALSE;
}
}
else MessageBox(NULL,"problems are not there...","",MB_OK);//I got this
messagebox


I GOT THESE MESSAGES ONLY:
Trying to copy properties
copied properties
copyto fail
problems are not there...


Can you give any suggestions?
How to solve this problem?

For copying properties, should I include any supporting files or dlls while
creating setup?

With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dkds.Naidu
Thank you for your response. sorry for the last post.
While developing application, it works fine.I got more than 500 mails
backup.Then, I created setup for this application.Now, it has crash problems
while copying properties. With setup, I can create .msg file with 0 bytes
only and it is getting crash.
STDMETHODIMP
CExchangeAddin::OnDelivery(IExchExtCallback *lpExchangeCallback)
{
LPMESSAGE lpMessage = NULL;
LPMDB lpMdb = NULL;
if (SUCCEEDED(lpExchangeCallback->GetObject(&lpMdb, (LPMAPIPROP*)&lpMessage)))
{
char chFilePath[500];
HRESULT hRes = S_OK;
LPSPropValue pSubject = NULL;
CComPtr<IStorage> pStorage;
LPMSGSESS pMsgSession = NULL;
LPMESSAGE pIMsg = NULL;
LPWSTR lpWideCharStr = NULL;
ULONG cbStrSize = 0L;
SizedSPropTagArray ( 7, excludeTags );
USES_CONVERSION;
//Got the complete file path into "chFilePath"
lpWideCharStr = A2W(chFilePath);
LPMALLOC pMalloc = MAPIGetDefaultMalloc();
hRes = ::StgCreateDocfile(lpWideCharStr,STGM_READWRITE |STGM_TRANSACTED
|STGM_CREATE, 0, &pStorage);
hRes = ::StgCreateStorageEx(lpWideCharStr,STGM_READWRITE |STGM_TRANSACTED
|STGM_CREATE,STGFMT_STORAGE,0,
NULL,NULL,IID_IStorage,reinterpret_cast<void**>(&pStorage));
hRes = ::OpenIMsgSession(pMalloc, 0, &pMsgSession);
hRes =
::OpenIMsgOnIStg(pMsgSession,MAPIAllocateBuffer,MAPIAllocateMore,MAPIFreeBuffer,pMalloc,NULL,pStorage,NULL, 0, 0, &pIMsg);
hRes = WriteClassStg(pStorage, CLSID_MailMessage );
excludeTags.cValues = 7;
excludeTags.aulPropTag[0] = PR_ACCESS;
excludeTags.aulPropTag[1] = PR_BODY;
excludeTags.aulPropTag[2] = PR_RTF_SYNC_BODY_COUNT;
excludeTags.aulPropTag[3] = PR_RTF_SYNC_BODY_CRC;
excludeTags.aulPropTag[4] = PR_RTF_SYNC_BODY_TAG;
excludeTags.aulPropTag[5] = PR_RTF_SYNC_PREFIX_COUNT;
excludeTags.aulPropTag[6] = PR_RTF_SYNC_TRAILING_COUNT;
hRes = lpMessage -> CopyTo(0,
NULL,(LPSPropTagArray)&excludeTags,NULL,
NULL,(LPIID)&IID_IMessage,pIMsg, 0, NULL );
/**************************************/
When copying properties from lpMessage to pIMsg, Outlook gets
crash problem.I tried with excludeTags parameter and without excludeTags
parameter(ie. NULL).
/**************************************/
}
}
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
IMessage on IStorage is returned in the pIMsg variable by OpenIMsgOnIStg(),
but you are using the pIBackupMsg variable when calling CopyTo().
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Thank you for your immediate response.
Application crashed where copying properties from one message to another
message.
char chFilePath[500];
HRESULT hRes = S_OK;
LPSPropValue pSubject = NULL;
CComPtr<IStorage> pStorage;
LPMSGSESS pMsgSession = NULL;
LPMESSAGE pIBackupMsg = NULL;
LPWSTR lpWideCharStr = NULL;
ULONG cbStrSize = 0L;
SizedSPropTagArray ( 7, excludeTags );
//Got the complete file path into "chFilePath"
lpWideCharStr = A2W(chFilePath);
LPMALLOC pMalloc = MAPIGetDefaultMalloc();
hRes = ::StgCreateDocfile(lpWideCharStr,STGM_READWRITE |STGM_TRANSACTED
|STGM_CREATE, 0, &pStorage);
hRes = ::StgCreateStorageEx(lpWideCharStr,STGM_READWRITE |STGM_TRANSACTED
|STGM_CREATE,STGFMT_STORAGE,0,
NULL,NULL,IID_IStorage,reinterpret_cast<void**>(&pStorage));
hRes = ::OpenIMsgSession(pMalloc, 0, &pMsgSession);
hRes =
::OpenIMsgOnIStg(pMsgSession,MAPIAllocateBuffer,MAPIAllocateMore,MAPIFreeBuffer,pMalloc,NULL,pStorage,NULL,
0, 0, &pIMsg);
hRes = WriteClassStg(pStorage, CLSID_MailMessage );
excludeTags.cValues = 7;
excludeTags.aulPropTag[0] = PR_ACCESS;
excludeTags.aulPropTag[1] = PR_BODY;
excludeTags.aulPropTag[2] = PR_RTF_SYNC_BODY_COUNT;
excludeTags.aulPropTag[3] = PR_RTF_SYNC_BODY_CRC;
excludeTags.aulPropTag[4] = PR_RTF_SYNC_BODY_TAG;
excludeTags.aulPropTag[5] = PR_RTF_SYNC_PREFIX_COUNT;
excludeTags.aulPropTag[6] = PR_RTF_SYNC_TRAILING_COUNT;
hRes = lpOriginalMessage -> CopyTo(0,
NULL,(LPSPropTagArray)&excludeTags,NULL,
NULL,(LPIID)&IID_IMessage,pIBackupMsg, 0, NULL );
/**************************************/
When copying properties from lpOriginalMessage to pIBackupMsg, Outlook gets
crash problem.I tried with excludeTags parameter and without excludeTags
parameter(ie. NULL).
/**************************************/
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
What is the error returned by CopyTo()?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
I followed http://support.microsoft.com/?kbid=171907 article.
I can take backup of all incoming mails through programmatically.I can do
backup and restore of hundreds of mails. Really, it works fine. But, after
creating setup of our application which is fails at
lpMessage->CopyTo(......)
function everytime. How can I solve this problem? after creating setup only,
it has this problem.
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
I have to disagree: you will have problems with any format. MIME might
be
a
good alternative, but it poses even greater conversion problems, especially
with the MAPI specific features, such as pure RTF messages, embedded OLE
attachments, etc.
You can of course develop your own format, but I suspect that it will take
you months to design and debug it to bring the number of bugs down to the
level that you will encounter with the MSG format.
The biggest MSG format problem is the messages with a large # of
recipients,
but it easy to work around it by ussing StgCreateStorageEx (Windows
2000
and
up) rather than StgCreateDocfile.
http://support.microsoft.com/?kbid=171907
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Stephen Griffin
I would NOT use MSG as a means for message archiving/backup. This message
format is not suitable for storing all the variety of messages you will
encounter in the wild. In particular, deeply nested messages and messages
with large numbers of recipients and/or attachments will present
unsolvable
problems with this format. Also, you lose a great deal in message
fidelity
in conversion to and from this format.
You will be much better off developing your own format in which to
archive
the messages, or (since it looks like this may be an in-house project),
locating a third party who has already done this work.
Steve
Post by Dkds.Naidu
Hi Dmitry,
I am trying to design a utilty in Outlook where the
user
is
given the provision of saving a copy of the every incoming mail in
a
desired
location (currently in our server).
This utility will enable the user to resore/downlaod
his
mails
from the server once the user moves from his current place to a
different
geographical location.
Currently am able to capture all the mails (
OnDelivery()
method of IExchExtSessionEvents) .How to save this mails in .MSG
format
with
UNICODE support?
I wonder whether am proceeding in the right direction in my quest
to
design
the above mentioned utilty!
1. How can I save the incoming mail in .MSG format with UNICODE
support.
Note: I can trap the incoming mail. How to save this mail with .msg
format
and with unicode support.
2. Can I restore mails if I save mails in .msg with unicode support.
Seeking your guidance
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
What kind of backup? *Where* do you want to store the messages?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
I love you Dmitry. Really you are giving lot of help.
Anyway, I have to take backup of all incoming mails and restore
all
Dmitry Streblechenko
2005-08-31 17:33:26 UTC
Permalink
So what is the value of hRes returned by CopyTo?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Just now, I tried with below code snippet. It behaves differently. I have
taken LPSPropProblemArray.
LPSPropProblemArray pProblems;
try{
MessageBox(NULL,"Trying to copy properties","",MB_OK);//I got this messagebox
hRes = lpMessage -> CopyTo(0, NULL,(LPSPropTagArray)&excludeTags,NULL,
NULL,(LPIID)&IID_IMessage,pIMsg, 0, &pProblems);
MessageBox(NULL,"copied properties","",MB_OK);//I got this messagebox
}catch(...)
{
MessageBox(NULL,"catch block","",MB_OK);
}
if (hRes == S_OK )
MessageBox(NULL,"S_OK ","",MB_OK);
if (hRes == MAPI_E_COLLISION )
MessageBox(NULL,"MAPI_E_COLLISION ","",MB_OK);
if (hRes == MAPI_E_DECLINE_COPY )
MessageBox(NULL,"MAPI_E_DECLINE_COPY ","",MB_OK);
if (hRes == MAPI_E_FOLDER_CYCLE )
MessageBox(NULL,"MAPI_E_FOLDER_CYCLE ","",MB_OK);
if (hRes == MAPI_E_INTERFACE_NOT_SUPPORTED )
MessageBox(NULL,"MAPI_E_INTERFACE_NOT_SUPPORTED ","",MB_OK);
if (hRes == MAPI_E_NO_ACCESS)
MessageBox(NULL,"MAPI_E_NO_ACCESS ","",MB_OK);
if (hRes == S_FALSE)
MessageBox(NULL,"S_FALSE","",MB_OK);
if (SUCCEEDED(hRes)) MessageBox(NULL,"copyto succ","",MB_OK);
else
{
MessageBox(NULL,"copyto fail","",MB_OK);//I got this messagebox
if (pProblems != NULL)
{
int nNoOfStructures = pProblems->cProblem;
FILE* fp = fopen("C:\\Problems.txt","a+");
fprintf(fp,"No Of Problems:: %d\n\n",nNoOfStructures);
fclose(fp);
for (int i = 1; i <= nNoOfStructures; i ++)
{
FILE* fp = fopen("C:\\Problems.txt","a+");
fprintf(fp,"%d\t%d\t%d\n",pProblems->aProblem->ulIndex,pProblems->aProblem->ulPropTag,pProblems->aProblem->scode);
fclose(fp);
}
return S_FALSE;
}
}
else MessageBox(NULL,"problems are not there...","",MB_OK);//I got this
messagebox
Trying to copy properties
copied properties
copyto fail
problems are not there...
Can you give any suggestions?
How to solve this problem?
For copying properties, should I include any supporting files or dlls while
creating setup?
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dkds.Naidu
Thank you for your response. sorry for the last post.
While developing application, it works fine.I got more than 500 mails
backup.Then, I created setup for this application.Now, it has crash problems
while copying properties. With setup, I can create .msg file with 0 bytes
only and it is getting crash.
STDMETHODIMP
CExchangeAddin::OnDelivery(IExchExtCallback *lpExchangeCallback)
{
LPMESSAGE lpMessage = NULL;
LPMDB lpMdb = NULL;
if (SUCCEEDED(lpExchangeCallback->GetObject(&lpMdb,
(LPMAPIPROP*)&lpMessage)))
{
char chFilePath[500];
HRESULT hRes = S_OK;
LPSPropValue pSubject = NULL;
CComPtr<IStorage> pStorage;
LPMSGSESS pMsgSession = NULL;
LPMESSAGE pIMsg = NULL;
LPWSTR lpWideCharStr = NULL;
ULONG cbStrSize = 0L;
SizedSPropTagArray ( 7, excludeTags );
USES_CONVERSION;
//Got the complete file path into "chFilePath"
lpWideCharStr = A2W(chFilePath);
LPMALLOC pMalloc = MAPIGetDefaultMalloc();
hRes = ::StgCreateDocfile(lpWideCharStr,STGM_READWRITE |STGM_TRANSACTED
|STGM_CREATE, 0, &pStorage);
hRes = ::StgCreateStorageEx(lpWideCharStr,STGM_READWRITE |STGM_TRANSACTED
|STGM_CREATE,STGFMT_STORAGE,0,
NULL,NULL,IID_IStorage,reinterpret_cast<void**>(&pStorage));
hRes = ::OpenIMsgSession(pMalloc, 0, &pMsgSession);
hRes =
::OpenIMsgOnIStg(pMsgSession,MAPIAllocateBuffer,MAPIAllocateMore,MAPIFreeBuffer,pMalloc,NULL,pStorage,NULL,
0, 0, &pIMsg);
hRes = WriteClassStg(pStorage, CLSID_MailMessage );
excludeTags.cValues = 7;
excludeTags.aulPropTag[0] = PR_ACCESS;
excludeTags.aulPropTag[1] = PR_BODY;
excludeTags.aulPropTag[2] = PR_RTF_SYNC_BODY_COUNT;
excludeTags.aulPropTag[3] = PR_RTF_SYNC_BODY_CRC;
excludeTags.aulPropTag[4] = PR_RTF_SYNC_BODY_TAG;
excludeTags.aulPropTag[5] = PR_RTF_SYNC_PREFIX_COUNT;
excludeTags.aulPropTag[6] = PR_RTF_SYNC_TRAILING_COUNT;
hRes = lpMessage -> CopyTo(0,
NULL,(LPSPropTagArray)&excludeTags,NULL,
NULL,(LPIID)&IID_IMessage,pIMsg, 0, NULL );
/**************************************/
When copying properties from lpMessage to pIMsg, Outlook gets
crash problem.I tried with excludeTags parameter and without excludeTags
parameter(ie. NULL).
/**************************************/
}
}
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
IMessage on IStorage is returned in the pIMsg variable by
OpenIMsgOnIStg(),
but you are using the pIBackupMsg variable when calling CopyTo().
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Thank you for your immediate response.
Application crashed where copying properties from one message to another
message.
char chFilePath[500];
HRESULT hRes = S_OK;
LPSPropValue pSubject = NULL;
CComPtr<IStorage> pStorage;
LPMSGSESS pMsgSession = NULL;
LPMESSAGE pIBackupMsg = NULL;
LPWSTR lpWideCharStr = NULL;
ULONG cbStrSize = 0L;
SizedSPropTagArray ( 7, excludeTags );
//Got the complete file path into "chFilePath"
lpWideCharStr = A2W(chFilePath);
LPMALLOC pMalloc = MAPIGetDefaultMalloc();
hRes = ::StgCreateDocfile(lpWideCharStr,STGM_READWRITE
|STGM_TRANSACTED
|STGM_CREATE, 0, &pStorage);
hRes = ::StgCreateStorageEx(lpWideCharStr,STGM_READWRITE
|STGM_TRANSACTED
|STGM_CREATE,STGFMT_STORAGE,0,
NULL,NULL,IID_IStorage,reinterpret_cast<void**>(&pStorage));
hRes = ::OpenIMsgSession(pMalloc, 0, &pMsgSession);
hRes =
::OpenIMsgOnIStg(pMsgSession,MAPIAllocateBuffer,MAPIAllocateMore,MAPIFreeBuffer,pMalloc,NULL,pStorage,NULL,
0, 0, &pIMsg);
hRes = WriteClassStg(pStorage, CLSID_MailMessage );
excludeTags.cValues = 7;
excludeTags.aulPropTag[0] = PR_ACCESS;
excludeTags.aulPropTag[1] = PR_BODY;
excludeTags.aulPropTag[2] = PR_RTF_SYNC_BODY_COUNT;
excludeTags.aulPropTag[3] = PR_RTF_SYNC_BODY_CRC;
excludeTags.aulPropTag[4] = PR_RTF_SYNC_BODY_TAG;
excludeTags.aulPropTag[5] = PR_RTF_SYNC_PREFIX_COUNT;
excludeTags.aulPropTag[6] = PR_RTF_SYNC_TRAILING_COUNT;
hRes = lpOriginalMessage -> CopyTo(0,
NULL,(LPSPropTagArray)&excludeTags,NULL,
NULL,(LPIID)&IID_IMessage,pIBackupMsg, 0, NULL );
/**************************************/
When copying properties from lpOriginalMessage to pIBackupMsg,
Outlook
gets
crash problem.I tried with excludeTags parameter and without excludeTags
parameter(ie. NULL).
/**************************************/
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
What is the error returned by CopyTo()?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
I followed http://support.microsoft.com/?kbid=171907 article.
I can take backup of all incoming mails through programmatically.I
can
do
backup and restore of hundreds of mails. Really, it works fine.
But,
after
creating setup of our application which is fails at
lpMessage->CopyTo(......)
function everytime. How can I solve this problem? after creating
setup
only,
it has this problem.
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
I have to disagree: you will have problems with any format. MIME might
be
a
good alternative, but it poses even greater conversion problems,
especially
with the MAPI specific features, such as pure RTF messages,
embedded
OLE
attachments, etc.
You can of course develop your own format, but I suspect that it
will
take
you months to design and debug it to bring the number of bugs
down to
the
level that you will encounter with the MSG format.
The biggest MSG format problem is the messages with a large # of
recipients,
but it easy to work around it by ussing StgCreateStorageEx (Windows
2000
and
up) rather than StgCreateDocfile.
Q171907 has sample code that shows how to save a message in the
MSG
http://support.microsoft.com/?kbid=171907
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Stephen Griffin
I would NOT use MSG as a means for message archiving/backup.
This
message
format is not suitable for storing all the variety of messages
you
will
encounter in the wild. In particular, deeply nested messages and
messages
with large numbers of recipients and/or attachments will present
unsolvable
problems with this format. Also, you lose a great deal in message
fidelity
in conversion to and from this format.
You will be much better off developing your own format in which to
archive
the messages, or (since it looks like this may be an in-house
project),
locating a third party who has already done this work.
Steve
Post by Dkds.Naidu
Hi Dmitry,
I am trying to design a utilty in Outlook where the
user
is
given the provision of saving a copy of the every incoming mail in
a
desired
location (currently in our server).
This utility will enable the user to
resore/downlaod
his
mails
from the server once the user moves from his current place to a
different
geographical location.
Currently am able to capture all the mails (
OnDelivery()
method of IExchExtSessionEvents) .How to save this mails in .MSG
format
with
UNICODE support?
I wonder whether am proceeding in the right direction in my quest
to
design
the above mentioned utilty!
1. How can I save the incoming mail in .MSG format with UNICODE
support.
Note: I can trap the incoming mail. How to save this mail with .msg
format
and with unicode support.
2. Can I restore mails if I save mails in .msg with unicode
support.
Seeking your guidance
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
What kind of backup? *Where* do you want to store the messages?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
I love you Dmitry. Really you are giving lot of help.
Anyway, I have to take backup of all incoming mails and
restore
all
Dkds.Naidu
2005-09-01 12:02:04 UTC
Permalink
Thank you for your response.I solved this problem.
Actually, I created pIMsg with StgCreateDocfile and StgCreateStorageEx.
By mistakenly I did this one. Now, I created pIMsg with StgCreateStorageEx
only.

Now It works fine. Thank you for your nice co-operation.

Once again Thank you.

with regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
So what is the value of hRes returned by CopyTo?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Just now, I tried with below code snippet. It behaves differently. I have
taken LPSPropProblemArray.
LPSPropProblemArray pProblems;
try{
MessageBox(NULL,"Trying to copy properties","",MB_OK);//I got this messagebox
hRes = lpMessage -> CopyTo(0, NULL,(LPSPropTagArray)&excludeTags,NULL,
NULL,(LPIID)&IID_IMessage,pIMsg, 0, &pProblems);
MessageBox(NULL,"copied properties","",MB_OK);//I got this messagebox
}catch(...)
{
MessageBox(NULL,"catch block","",MB_OK);
}
if (hRes == S_OK )
MessageBox(NULL,"S_OK ","",MB_OK);
if (hRes == MAPI_E_COLLISION )
MessageBox(NULL,"MAPI_E_COLLISION ","",MB_OK);
if (hRes == MAPI_E_DECLINE_COPY )
MessageBox(NULL,"MAPI_E_DECLINE_COPY ","",MB_OK);
if (hRes == MAPI_E_FOLDER_CYCLE )
MessageBox(NULL,"MAPI_E_FOLDER_CYCLE ","",MB_OK);
if (hRes == MAPI_E_INTERFACE_NOT_SUPPORTED )
MessageBox(NULL,"MAPI_E_INTERFACE_NOT_SUPPORTED ","",MB_OK);
if (hRes == MAPI_E_NO_ACCESS)
MessageBox(NULL,"MAPI_E_NO_ACCESS ","",MB_OK);
if (hRes == S_FALSE)
MessageBox(NULL,"S_FALSE","",MB_OK);
if (SUCCEEDED(hRes)) MessageBox(NULL,"copyto succ","",MB_OK);
else
{
MessageBox(NULL,"copyto fail","",MB_OK);//I got this messagebox
if (pProblems != NULL)
{
int nNoOfStructures = pProblems->cProblem;
FILE* fp = fopen("C:\\Problems.txt","a+");
fprintf(fp,"No Of Problems:: %d\n\n",nNoOfStructures);
fclose(fp);
for (int i = 1; i <= nNoOfStructures; i ++)
{
FILE* fp = fopen("C:\\Problems.txt","a+");
fprintf(fp,"%d\t%d\t%d\n",pProblems->aProblem->ulIndex,pProblems->aProblem->ulPropTag,pProblems->aProblem->scode);
fclose(fp);
}
return S_FALSE;
}
}
else MessageBox(NULL,"problems are not there...","",MB_OK);//I got this
messagebox
Trying to copy properties
copied properties
copyto fail
problems are not there...
Can you give any suggestions?
How to solve this problem?
For copying properties, should I include any supporting files or dlls while
creating setup?
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dkds.Naidu
Thank you for your response. sorry for the last post.
While developing application, it works fine.I got more than 500 mails
backup.Then, I created setup for this application.Now, it has crash problems
while copying properties. With setup, I can create .msg file with 0 bytes
only and it is getting crash.
STDMETHODIMP
CExchangeAddin::OnDelivery(IExchExtCallback *lpExchangeCallback)
{
LPMESSAGE lpMessage = NULL;
LPMDB lpMdb = NULL;
if (SUCCEEDED(lpExchangeCallback->GetObject(&lpMdb,
(LPMAPIPROP*)&lpMessage)))
{
char chFilePath[500];
HRESULT hRes = S_OK;
LPSPropValue pSubject = NULL;
CComPtr<IStorage> pStorage;
LPMSGSESS pMsgSession = NULL;
LPMESSAGE pIMsg = NULL;
LPWSTR lpWideCharStr = NULL;
ULONG cbStrSize = 0L;
SizedSPropTagArray ( 7, excludeTags );
USES_CONVERSION;
//Got the complete file path into "chFilePath"
lpWideCharStr = A2W(chFilePath);
LPMALLOC pMalloc = MAPIGetDefaultMalloc();
hRes = ::StgCreateDocfile(lpWideCharStr,STGM_READWRITE |STGM_TRANSACTED
|STGM_CREATE, 0, &pStorage);
hRes = ::StgCreateStorageEx(lpWideCharStr,STGM_READWRITE |STGM_TRANSACTED
|STGM_CREATE,STGFMT_STORAGE,0,
NULL,NULL,IID_IStorage,reinterpret_cast<void**>(&pStorage));
hRes = ::OpenIMsgSession(pMalloc, 0, &pMsgSession);
hRes =
::OpenIMsgOnIStg(pMsgSession,MAPIAllocateBuffer,MAPIAllocateMore,MAPIFreeBuffer,pMalloc,NULL,pStorage,NULL,
0, 0, &pIMsg);
hRes = WriteClassStg(pStorage, CLSID_MailMessage );
excludeTags.cValues = 7;
excludeTags.aulPropTag[0] = PR_ACCESS;
excludeTags.aulPropTag[1] = PR_BODY;
excludeTags.aulPropTag[2] = PR_RTF_SYNC_BODY_COUNT;
excludeTags.aulPropTag[3] = PR_RTF_SYNC_BODY_CRC;
excludeTags.aulPropTag[4] = PR_RTF_SYNC_BODY_TAG;
excludeTags.aulPropTag[5] = PR_RTF_SYNC_PREFIX_COUNT;
excludeTags.aulPropTag[6] = PR_RTF_SYNC_TRAILING_COUNT;
hRes = lpMessage -> CopyTo(0,
NULL,(LPSPropTagArray)&excludeTags,NULL,
NULL,(LPIID)&IID_IMessage,pIMsg, 0, NULL );
/**************************************/
When copying properties from lpMessage to pIMsg, Outlook gets
crash problem.I tried with excludeTags parameter and without excludeTags
parameter(ie. NULL).
/**************************************/
}
}
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
IMessage on IStorage is returned in the pIMsg variable by
OpenIMsgOnIStg(),
but you are using the pIBackupMsg variable when calling CopyTo().
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Thank you for your immediate response.
Application crashed where copying properties from one message to another
message.
char chFilePath[500];
HRESULT hRes = S_OK;
LPSPropValue pSubject = NULL;
CComPtr<IStorage> pStorage;
LPMSGSESS pMsgSession = NULL;
LPMESSAGE pIBackupMsg = NULL;
LPWSTR lpWideCharStr = NULL;
ULONG cbStrSize = 0L;
SizedSPropTagArray ( 7, excludeTags );
//Got the complete file path into "chFilePath"
lpWideCharStr = A2W(chFilePath);
LPMALLOC pMalloc = MAPIGetDefaultMalloc();
hRes = ::StgCreateDocfile(lpWideCharStr,STGM_READWRITE
|STGM_TRANSACTED
|STGM_CREATE, 0, &pStorage);
hRes = ::StgCreateStorageEx(lpWideCharStr,STGM_READWRITE |STGM_TRANSACTED
|STGM_CREATE,STGFMT_STORAGE,0,
NULL,NULL,IID_IStorage,reinterpret_cast<void**>(&pStorage));
hRes = ::OpenIMsgSession(pMalloc, 0, &pMsgSession);
hRes =
::OpenIMsgOnIStg(pMsgSession,MAPIAllocateBuffer,MAPIAllocateMore,MAPIFreeBuffer,pMalloc,NULL,pStorage,NULL,
0, 0, &pIMsg);
hRes = WriteClassStg(pStorage, CLSID_MailMessage );
excludeTags.cValues = 7;
excludeTags.aulPropTag[0] = PR_ACCESS;
excludeTags.aulPropTag[1] = PR_BODY;
excludeTags.aulPropTag[2] = PR_RTF_SYNC_BODY_COUNT;
excludeTags.aulPropTag[3] = PR_RTF_SYNC_BODY_CRC;
excludeTags.aulPropTag[4] = PR_RTF_SYNC_BODY_TAG;
excludeTags.aulPropTag[5] = PR_RTF_SYNC_PREFIX_COUNT;
excludeTags.aulPropTag[6] = PR_RTF_SYNC_TRAILING_COUNT;
hRes = lpOriginalMessage -> CopyTo(0,
NULL,(LPSPropTagArray)&excludeTags,NULL,
NULL,(LPIID)&IID_IMessage,pIBackupMsg, 0, NULL );
/**************************************/
When copying properties from lpOriginalMessage to pIBackupMsg,
Outlook
gets
crash problem.I tried with excludeTags parameter and without excludeTags
parameter(ie. NULL).
/**************************************/
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
What is the error returned by CopyTo()?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
I followed http://support.microsoft.com/?kbid=171907 article.
I can take backup of all incoming mails through programmatically.I
can
do
backup and restore of hundreds of mails. Really, it works fine.
But,
after
creating setup of our application which is fails at
lpMessage->CopyTo(......)
function everytime. How can I solve this problem? after creating
setup
only,
it has this problem.
Thanks in advance.
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
I have to disagree: you will have problems with any format. MIME
might
be
a
good alternative, but it poses even greater conversion problems,
especially
with the MAPI specific features, such as pure RTF messages,
embedded
OLE
attachments, etc.
You can of course develop your own format, but I suspect that it
will
take
you months to design and debug it to bring the number of bugs
down to
the
Dkds.Naidu
2005-08-12 06:05:01 UTC
Permalink
yes.I am using Exchange Client Extension.
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dmitry Streblechenko
You mean you have an Exchange Client Extension, not a COM add-in, right?
What kind of backup do you have in mind? Outlook folder? DB? MSG file?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am trying to
take backup of all incoming mails. I overridden OnDelivery method of
IExchExtSessionEvents interface. I can trap all incoming mails. But how can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Dkds.Naidu
2005-09-02 05:29:01 UTC
Permalink
Hi Dmitry,

What about .eml format? May I take backup files as .eml format? Is it
correct way? Just now I tested 100+ mails with .eml format. Backup and
restore works fine.

Any disadvantages are there with .eml format?

.MSG format is also working fine.

Give me your valuable suggestions.

With regards,
DKDS.Naidu.
Post by Dmitry Streblechenko
You mean you have an Exchange Client Extension, not a COM add-in, right?
What kind of backup do you have in mind? Outlook folder? DB? MSG file?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am trying to
take backup of all incoming mails. I overridden OnDelivery method of
IExchExtSessionEvents interface. I can trap all incoming mails. But how can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Dmitry Streblechenko
2005-09-02 05:33:33 UTC
Permalink
MIME will not preserve all the Extended MAPI properties unless you save in
the TNEF format (the infamouse winmail.dat attachment).

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
What about .eml format? May I take backup files as .eml format? Is it
correct way? Just now I tested 100+ mails with .eml format. Backup and
restore works fine.
Any disadvantages are there with .eml format?
.MSG format is also working fine.
Give me your valuable suggestions.
With regards,
DKDS.Naidu.
Post by Dmitry Streblechenko
You mean you have an Exchange Client Extension, not a COM add-in, right?
What kind of backup do you have in mind? Outlook folder? DB? MSG file?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am trying to
take backup of all incoming mails. I overridden OnDelivery method of
IExchExtSessionEvents interface. I can trap all incoming mails. But how can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Dkds.Naidu
2005-09-02 06:28:05 UTC
Permalink
Hi Dmitry,

Thank you for your immediate response.

If you dont mind, can u send me the link about MIME and TNEF format.

Till now, I used MAPI, Extended MAPI and Exchange Extension Interfaces for
Incoming mails only.

Thanks in advance.

my id: ***@hotmail.com

With regards,
DKDS.Naidu,
Post by Dmitry Streblechenko
MIME will not preserve all the Extended MAPI properties unless you save in
the TNEF format (the infamouse winmail.dat attachment).
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
What about .eml format? May I take backup files as .eml format? Is it
correct way? Just now I tested 100+ mails with .eml format. Backup and
restore works fine.
Any disadvantages are there with .eml format?
.MSG format is also working fine.
Give me your valuable suggestions.
With regards,
DKDS.Naidu.
Post by Dmitry Streblechenko
You mean you have an Exchange Client Extension, not a COM add-in, right?
What kind of backup do you have in mind? Outlook folder? DB? MSG file?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am trying to
take backup of all incoming mails. I overridden OnDelivery method of
IExchExtSessionEvents interface. I can trap all incoming mails. But how can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Dmitry Streblechenko
2005-09-02 18:30:19 UTC
Permalink
I am not aware of any specifi links: essentially a mesage is saved to a TNEF
stream (which is standard and is documented on MSDN), then when a message is
sent, only the plain text body of the message is included (if it has one)
and a special attachment with the content type of "application/ms-tnef".

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
Thank you for your immediate response.
If you dont mind, can u send me the link about MIME and TNEF format.
Till now, I used MAPI, Extended MAPI and Exchange Extension Interfaces for
Incoming mails only.
Thanks in advance.
With regards,
DKDS.Naidu,
Post by Dmitry Streblechenko
MIME will not preserve all the Extended MAPI properties unless you save in
the TNEF format (the infamouse winmail.dat attachment).
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi Dmitry,
What about .eml format? May I take backup files as .eml format? Is it
correct way? Just now I tested 100+ mails with .eml format. Backup and
restore works fine.
Any disadvantages are there with .eml format?
.MSG format is also working fine.
Give me your valuable suggestions.
With regards,
DKDS.Naidu.
Post by Dmitry Streblechenko
You mean you have an Exchange Client Extension, not a COM add-in, right?
What kind of backup do you have in mind? Outlook folder? DB? MSG file?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am trying to
take backup of all incoming mails. I overridden OnDelivery method of
IExchExtSessionEvents interface. I can trap all incoming mails. But
how
can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Eugene
2005-08-17 22:12:35 UTC
Permalink
Not a 100% solution but can be usefull

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/olintapi/html/oliaIConverterSession_HV01154520.asp

To backup:

HRESULT IConverterSession::MAPIToMIMEStm(
LPMESSAGE pmsg,
LPSTREAM pstm,
ULONG ulFlags
);

try ulFlags = 0xC14
undocumented but allows to store embedded RTF content

To restore:

HRESULT IConverterSession:: MIMEToMAPI (
LPSTREAM pstm,
LPMESSAGE pmsg,
LPCSTR pszSrcSrv,
ULONG ulFlags
);
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am trying to
take backup of all incoming mails. I overridden OnDelivery method of
IExchExtSessionEvents interface. I can trap all incoming mails. But how can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Dkds.Naidu
2005-08-18 14:03:06 UTC
Permalink
Hi Eugene,

Thank you for your suggestion. I ahve to do R&D on this topic.
Plz let me know if you have any other effective methods.


Thanks in advance.

with regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Eugene
Not a 100% solution but can be usefull
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/olintapi/html/oliaIConverterSession_HV01154520.asp
HRESULT IConverterSession::MAPIToMIMEStm(
LPMESSAGE pmsg,
LPSTREAM pstm,
ULONG ulFlags
);
try ulFlags = 0xC14
undocumented but allows to store embedded RTF content
HRESULT IConverterSession:: MIMEToMAPI (
LPSTREAM pstm,
LPMESSAGE pmsg,
LPCSTR pszSrcSrv,
ULONG ulFlags
);
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am trying to
take backup of all incoming mails. I overridden OnDelivery method of
IExchExtSessionEvents interface. I can trap all incoming mails. But how can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Eugene
2005-08-18 14:41:28 UTC
Permalink
Described method is a good choice for you from my understanding.
Instead of inventing the wheel reuse existing one.
It is free from MSG broblem works everywhere ( OL2000 - OL2003 ) and being
used by Outlook everytime you seding secure mail. ( Probably when you
sending from "internet mail only" configuration as well )

There is some limitations, as I know it doesn't support embedded diagrams
when you using word as mail editor :), and some other. But such limitations
nothing more than bugs. And almost every bug can be fixed.
Post by Dkds.Naidu
Hi Eugene,
Thank you for your suggestion. I ahve to do R&D on this topic.
Plz let me know if you have any other effective methods.
Thanks in advance.
with regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Eugene
Not a 100% solution but can be usefull
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/olintapi/html/oliaIConverterSession_HV01154520.asp
HRESULT IConverterSession::MAPIToMIMEStm(
LPMESSAGE pmsg,
LPSTREAM pstm,
ULONG ulFlags
);
try ulFlags = 0xC14
undocumented but allows to store embedded RTF content
HRESULT IConverterSession:: MIMEToMAPI (
LPSTREAM pstm,
LPMESSAGE pmsg,
LPCSTR pszSrcSrv,
ULONG ulFlags
);
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am trying to
take backup of all incoming mails. I overridden OnDelivery method of
IExchExtSessionEvents interface. I can trap all incoming mails. But how can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Dmitry Streblechenko
2005-08-18 16:55:17 UTC
Permalink
Well, it can be fixed if you have access to the source code...
You won't be able to save RTF messages with embedded OLE objects, Exchange
recipients won't have addresses at all, only display names, etc.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Eugene
Described method is a good choice for you from my understanding.
Instead of inventing the wheel reuse existing one.
It is free from MSG broblem works everywhere ( OL2000 - OL2003 ) and being
used by Outlook everytime you seding secure mail. ( Probably when you
sending from "internet mail only" configuration as well )
There is some limitations, as I know it doesn't support embedded diagrams
when you using word as mail editor :), and some other. But such
limitations nothing more than bugs. And almost every bug can be fixed.
Post by Dkds.Naidu
Hi Eugene,
Thank you for your suggestion. I ahve to do R&D on this topic.
Plz let me know if you have any other effective methods.
Thanks in advance.
with regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Eugene
Not a 100% solution but can be usefull
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/olintapi/html/oliaIConverterSession_HV01154520.asp
HRESULT IConverterSession::MAPIToMIMEStm(
LPMESSAGE pmsg,
LPSTREAM pstm,
ULONG ulFlags
);
try ulFlags = 0xC14
undocumented but allows to store embedded RTF content
HRESULT IConverterSession:: MIMEToMAPI (
LPSTREAM pstm,
LPMESSAGE pmsg,
LPCSTR pszSrcSrv,
ULONG ulFlags
);
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am trying to
take backup of all incoming mails. I overridden OnDelivery method of
IExchExtSessionEvents interface. I can trap all incoming mails. But
how
can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Eugene
2005-08-18 18:57:09 UTC
Permalink
I have no access to the source code, but after some research...
RTF messages with embedded OLE try MAPIToMIMEStm with flag 0xC10
Recipients problem can be solved separately or manually.
GetRecipientTableAddBook->ResolveName

Still better than inventing custom conversion and format.
Post by Dmitry Streblechenko
Well, it can be fixed if you have access to the source code...
You won't be able to save RTF messages with embedded OLE objects, Exchange
recipients won't have addresses at all, only display names, etc.
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Eugene
Described method is a good choice for you from my understanding.
Instead of inventing the wheel reuse existing one.
It is free from MSG broblem works everywhere ( OL2000 - OL2003 ) and
being used by Outlook everytime you seding secure mail. ( Probably when
you sending from "internet mail only" configuration as well )
There is some limitations, as I know it doesn't support embedded diagrams
when you using word as mail editor :), and some other. But such
limitations nothing more than bugs. And almost every bug can be fixed.
Post by Dkds.Naidu
Hi Eugene,
Thank you for your suggestion. I ahve to do R&D on this topic.
Plz let me know if you have any other effective methods.
Thanks in advance.
with regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Eugene
Not a 100% solution but can be usefull
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/olintapi/html/oliaIConverterSession_HV01154520.asp
HRESULT IConverterSession::MAPIToMIMEStm(
LPMESSAGE pmsg,
LPSTREAM pstm,
ULONG ulFlags
);
try ulFlags = 0xC14
undocumented but allows to store embedded RTF content
HRESULT IConverterSession:: MIMEToMAPI (
LPSTREAM pstm,
LPMESSAGE pmsg,
LPCSTR pszSrcSrv,
ULONG ulFlags
);
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am trying to
take backup of all incoming mails. I overridden OnDelivery method of
IExchExtSessionEvents interface. I can trap all incoming mails. But
how
can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Dkds.Naidu
2005-09-02 05:38:06 UTC
Permalink
Hi Eugene,

I have to take backup and restore of incoming mails from Outlook.

What about .eml format? May I take backup files as .eml format? Is it
correct way? Just now I tested 100+ mails with .eml format. Backup and
restore works fine.

Any disadvantages are there with .eml format?

.MSG format is also working fine.

Give me your valuable suggestions.

With regards,
DKDS.Naidu.
Post by Eugene
Not a 100% solution but can be usefull
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/olintapi/html/oliaIConverterSession_HV01154520.asp
HRESULT IConverterSession::MAPIToMIMEStm(
LPMESSAGE pmsg,
LPSTREAM pstm,
ULONG ulFlags
);
try ulFlags = 0xC14
undocumented but allows to store embedded RTF content
HRESULT IConverterSession:: MIMEToMAPI (
LPSTREAM pstm,
LPMESSAGE pmsg,
LPCSTR pszSrcSrv,
ULONG ulFlags
);
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am trying to
take backup of all incoming mails. I overridden OnDelivery method of
IExchExtSessionEvents interface. I can trap all incoming mails. But how can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Eugene
2005-09-07 20:25:10 UTC
Permalink
Known issues:
1) Not all of the embedded object can be restored after saving using TNEF
( for example inserted MS word diagram never get restored correctly, can be
more problem like this )
2) Recepients name resolution. Backup under exchange profile -> restoring
into Internet mail configuration. I never had a chance to test this
conversion with headers support, due to implementation reasons I'm using
CCSF_NOHEADERS all the time. But first vtable member aka "Placeholder
memberNot supported or documented". accept something like IAddressBook as
the first parameter... Maybe it can help...
3) Possible mail body format change after restore. Don't forget tot use
CCSF_USE_RTF.
4) Possible PR_MESSAGE_DELIVERY_TIME change after restore - try to use
0x0800.

As far as I know everything is there, probably there is a lot of other
problem. If you find another one let me know.
Post by Dkds.Naidu
Hi Eugene,
I have to take backup and restore of incoming mails from Outlook.
What about .eml format? May I take backup files as .eml format? Is it
correct way? Just now I tested 100+ mails with .eml format. Backup and
restore works fine.
Any disadvantages are there with .eml format?
.MSG format is also working fine.
Give me your valuable suggestions.
With regards,
DKDS.Naidu.
Post by Eugene
Not a 100% solution but can be usefull
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/olintapi/html/oliaIConverterSession_HV01154520.asp
HRESULT IConverterSession::MAPIToMIMEStm(
LPMESSAGE pmsg,
LPSTREAM pstm,
ULONG ulFlags
);
try ulFlags = 0xC14
undocumented but allows to store embedded RTF content
HRESULT IConverterSession:: MIMEToMAPI (
LPSTREAM pstm,
LPMESSAGE pmsg,
LPCSTR pszSrcSrv,
ULONG ulFlags
);
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am trying to
take backup of all incoming mails. I overridden OnDelivery method of
IExchExtSessionEvents interface. I can trap all incoming mails. But how can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Dkds.Naidu
2005-09-21 06:43:06 UTC
Permalink
Hi Eugene,

I am trying to use IConverterSession interface. I am getting errors
which are

error C2065: 'IConverterSession' : undeclared identifier.
error C2065: 'pIConverterSession' : undeclared identifier

I created one guiddef.h file. I copied CLSID & IID's from msdn.

rough code:

/******************guiddef.h*************************/

// {4e3a7680-b77a-11d0-9da5-00c04fd65685}

DEFINE_GUID(CLSID_IConverterSession, 0x4e3a7680, 0xb77a, 0x11d0, 0x9d, 0xa5,
0x0, 0xc0, 0x4f, 0xd6, 0x56, 0x85);


// {4b401570-b77b-11d0-9da5-00c04fd65685}

DEFINE_GUID(IID_IConverterSession, 0x4b401570, 0xb77b, 0x11d0, 0x9d, 0xa5,
0x0, 0xc0, 0x4f, 0xd6, 0x56, 0x85);

/*******************************************/


/******************MyClass.cpp*************************/

#include "guiddef.h"


void somefunction()
{
IConverterSession* pIConverterSession;
}
/*******************************************/

after compilation of MyClass.cpp file, getting erors.

How to solve this problem??

Thanks in advance,

With regards,
--
DKDS.Naidu.
Post by Eugene
1) Not all of the embedded object can be restored after saving using TNEF
( for example inserted MS word diagram never get restored correctly, can be
more problem like this )
2) Recepients name resolution. Backup under exchange profile -> restoring
into Internet mail configuration. I never had a chance to test this
conversion with headers support, due to implementation reasons I'm using
CCSF_NOHEADERS all the time. But first vtable member aka "Placeholder
memberNot supported or documented". accept something like IAddressBook as
the first parameter... Maybe it can help...
3) Possible mail body format change after restore. Don't forget tot use
CCSF_USE_RTF.
4) Possible PR_MESSAGE_DELIVERY_TIME change after restore - try to use
0x0800.
As far as I know everything is there, probably there is a lot of other
problem. If you find another one let me know.
Post by Dkds.Naidu
Hi Eugene,
I have to take backup and restore of incoming mails from Outlook.
What about .eml format? May I take backup files as .eml format? Is it
correct way? Just now I tested 100+ mails with .eml format. Backup and
restore works fine.
Any disadvantages are there with .eml format?
.MSG format is also working fine.
Give me your valuable suggestions.
With regards,
DKDS.Naidu.
Post by Eugene
Not a 100% solution but can be usefull
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/olintapi/html/oliaIConverterSession_HV01154520.asp
HRESULT IConverterSession::MAPIToMIMEStm(
LPMESSAGE pmsg,
LPSTREAM pstm,
ULONG ulFlags
);
try ulFlags = 0xC14
undocumented but allows to store embedded RTF content
HRESULT IConverterSession:: MIMEToMAPI (
LPSTREAM pstm,
LPMESSAGE pmsg,
LPCSTR pszSrcSrv,
ULONG ulFlags
);
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am trying to
take backup of all incoming mails. I overridden OnDelivery method of
IExchExtSessionEvents interface. I can trap all incoming mails. But how can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Dkds.Naidu
2005-09-21 12:56:01 UTC
Permalink
Hi Eugene,

I solved this problem. Sorry for the last post. I integrated
IConverterSession interface into my application.

With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Dkds.Naidu
Hi Eugene,
I am trying to use IConverterSession interface. I am getting errors
which are
error C2065: 'IConverterSession' : undeclared identifier.
error C2065: 'pIConverterSession' : undeclared identifier
I created one guiddef.h file. I copied CLSID & IID's from msdn.
/******************guiddef.h*************************/
// {4e3a7680-b77a-11d0-9da5-00c04fd65685}
DEFINE_GUID(CLSID_IConverterSession, 0x4e3a7680, 0xb77a, 0x11d0, 0x9d, 0xa5,
0x0, 0xc0, 0x4f, 0xd6, 0x56, 0x85);
// {4b401570-b77b-11d0-9da5-00c04fd65685}
DEFINE_GUID(IID_IConverterSession, 0x4b401570, 0xb77b, 0x11d0, 0x9d, 0xa5,
0x0, 0xc0, 0x4f, 0xd6, 0x56, 0x85);
/*******************************************/
/******************MyClass.cpp*************************/
#include "guiddef.h"
void somefunction()
{
IConverterSession* pIConverterSession;
}
/*******************************************/
after compilation of MyClass.cpp file, getting erors.
How to solve this problem??
Thanks in advance,
With regards,
--
DKDS.Naidu.
Post by Eugene
1) Not all of the embedded object can be restored after saving using TNEF
( for example inserted MS word diagram never get restored correctly, can be
more problem like this )
2) Recepients name resolution. Backup under exchange profile -> restoring
into Internet mail configuration. I never had a chance to test this
conversion with headers support, due to implementation reasons I'm using
CCSF_NOHEADERS all the time. But first vtable member aka "Placeholder
memberNot supported or documented". accept something like IAddressBook as
the first parameter... Maybe it can help...
3) Possible mail body format change after restore. Don't forget tot use
CCSF_USE_RTF.
4) Possible PR_MESSAGE_DELIVERY_TIME change after restore - try to use
0x0800.
As far as I know everything is there, probably there is a lot of other
problem. If you find another one let me know.
Post by Dkds.Naidu
Hi Eugene,
I have to take backup and restore of incoming mails from Outlook.
What about .eml format? May I take backup files as .eml format? Is it
correct way? Just now I tested 100+ mails with .eml format. Backup and
restore works fine.
Any disadvantages are there with .eml format?
.MSG format is also working fine.
Give me your valuable suggestions.
With regards,
DKDS.Naidu.
Post by Eugene
Not a 100% solution but can be usefull
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/olintapi/html/oliaIConverterSession_HV01154520.asp
HRESULT IConverterSession::MAPIToMIMEStm(
LPMESSAGE pmsg,
LPSTREAM pstm,
ULONG ulFlags
);
try ulFlags = 0xC14
undocumented but allows to store embedded RTF content
HRESULT IConverterSession:: MIMEToMAPI (
LPSTREAM pstm,
LPMESSAGE pmsg,
LPCSTR pszSrcSrv,
ULONG ulFlags
);
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am trying to
take backup of all incoming mails. I overridden OnDelivery method of
IExchExtSessionEvents interface. I can trap all incoming mails. But how can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Dkds.Naidu
2005-09-26 10:27:03 UTC
Permalink
Hi,

I integrated IConveterSession into my application. I have taken backup
with MAPIToMIMEStm(...) and restore with MIMEToMAPI(...). After restoring,
all mails have "STANDARD" toolbar with "SEND" button of MS Outlook. I mean,
mails are ready to send after restore opration.

How to solve this problem?


With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Eugene
Not a 100% solution but can be usefull
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/olintapi/html/oliaIConverterSession_HV01154520.asp
HRESULT IConverterSession::MAPIToMIMEStm(
LPMESSAGE pmsg,
LPSTREAM pstm,
ULONG ulFlags
);
try ulFlags = 0xC14
undocumented but allows to store embedded RTF content
HRESULT IConverterSession:: MIMEToMAPI (
LPSTREAM pstm,
LPMESSAGE pmsg,
LPCSTR pszSrcSrv,
ULONG ulFlags
);
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am trying to
take backup of all incoming mails. I overridden OnDelivery method of
IExchExtSessionEvents interface. I can trap all incoming mails. But how can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Dmitry Streblechenko
2005-09-26 17:03:43 UTC
Permalink
Remove the MSGFLAG_UNSENT bit from PR_MESSAGE_FLAGS *before* the message is
saved for the very first time.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Dkds.Naidu
Hi,
I integrated IConveterSession into my application. I have taken backup
with MAPIToMIMEStm(...) and restore with MIMEToMAPI(...). After restoring,
all mails have "STANDARD" toolbar with "SEND" button of MS Outlook. I mean,
mails are ready to send after restore opration.
How to solve this problem?
With regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
Post by Eugene
Not a 100% solution but can be usefull
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/olintapi/html/oliaIConverterSession_HV01154520.asp
HRESULT IConverterSession::MAPIToMIMEStm(
LPMESSAGE pmsg,
LPSTREAM pstm,
ULONG ulFlags
);
try ulFlags = 0xC14
undocumented but allows to store embedded RTF content
HRESULT IConverterSession:: MIMEToMAPI (
LPSTREAM pstm,
LPMESSAGE pmsg,
LPCSTR pszSrcSrv,
ULONG ulFlags
);
Post by Dkds.Naidu
Hi all,
I am developing ATL COM Addin for Microsoft Outlook. I am trying to
take backup of all incoming mails. I overridden OnDelivery method of
IExchExtSessionEvents interface. I can trap all incoming mails. But how can I
take a mail into backup and how to restore mails?
I am very new to this backup and restore mails. I know MAPI.
Can anybody suggest me?
Thanks in advance.
Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore,
INDIA.
Digambar Borse
2007-03-14 13:44:48 UTC
Permalink
Hi,
I faced the same problem for IConveterSession decleration.I'm useing
OOM & MAPI .I want to save the mail in MIME format.
I am not getting how you intergrate the IConveterSession interface to your
application to solve the problem, can you please expain in detail how to
solve following the error.

error C2065: 'IConverterSession' : undeclared identifier.

Thanking you,

Regards,
Digambar.
Dmitry Streblechenko
2007-03-15 06:24:07 UTC
Permalink
Dis you include the declaration of the IConverterSession interface?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by Digambar Borse
Hi,
I faced the same problem for IConveterSession decleration.I'm useing
OOM & MAPI .I want to save the mail in MIME format.
I am not getting how you intergrate the IConveterSession interface to your
application to solve the problem, can you please expain in detail how to
solve following the error.
error C2065: 'IConverterSession' : undeclared identifier.
Thanking you,
Regards,
Digambar.
Loading...