adding item.body="" seems to keep it.!
.Body = ""
.HTMLBody = some htmlcode
nan wrote:
losing mail body content after close event of mailItem
17-Aug-07
Hello
I have a mail item and I tried to add some text to this mail item by the
following cod
OutLookApplication = new ActiveXObject("Outlook.Application")
MailItem =
OutLookApplication.GetNamespace("MAPI").GetItemFromID(ItemID)
MailItem.HTMLBody = "<HTML><HEAD></HEAD
<BODY>HELLO</BODY></HTML>"
MailItem.Close(olSave)
After calling the MailItem.Close(olSave) method, the mail body has been
converted
to the followin
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"
<HTML
<HEAD
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7036.0"
</HEAD
<BODY
<!-- Converted from text/plain format --
</BODY
</HTML
and my text is gone, any idea? I have tried manually do the saving by
calling MailItem.Save and MailItem.Close(1), but this also doesn't work
Previous Posts In This Thread:
On Friday, August 17, 2007 11:30 AM
nan wrote:
losing mail body content after close event of mailItem
Hello
I have a mail item and I tried to add some text to this mail item by the
following cod
OutLookApplication = new ActiveXObject("Outlook.Application")
MailItem =
OutLookApplication.GetNamespace("MAPI").GetItemFromID(ItemID)
MailItem.HTMLBody = "<HTML><HEAD></HEAD
<BODY>HELLO</BODY></HTML>"
MailItem.Close(olSave)
After calling the MailItem.Close(olSave) method, the mail body has been
converted
to the followin
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"
<HTML
<HEAD
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7036.0"
</HEAD
<BODY
<!-- Converted from text/plain format --
</BODY
</HTML
and my text is gone, any idea? I have tried manually do the saving by
calling MailItem.Save and MailItem.Close(1), but this also doesn't work
On Tuesday, August 21, 2007 3:33 AM
Michael Bauer [MVP - Outlook] wrote:
Re: losing mail body content after close event of mailItem
MailItem.HTMLBody="hallo
MailItem.Sav
should do it. If you don't display an item then you don't need to close it
--
Viele Gruesse / Best regard
Michael Bauer - MVP Outloo
Organize eMails
<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6
Am Fri, 17 Aug 2007 08:30:06 -0700 schrieb nana:
On Tuesday, August 21, 2007 4:28 AM
nan wrote:
Re: losing mail body content after close event of mailItem
Hello Michael
Thanks, I will check that out. But is there any reason why on close event
will lose the changes? Is this a known issue?
Thanks
"Michael Bauer [MVP - Outlook]" wrote:
On Tuesday, August 21, 2007 12:36 PM
nan wrote:
Re: losing mail body content after close event of mailItem
I have just tried what you suggest. It doesn't work, the text is still
disappearing. Could there be any settings in the exchange server that is
causing this behavior?
"Michael Bauer [MVP - Outlook]" wrote:
On Wednesday, August 22, 2007 1:07 AM
Michael Bauer [MVP - Outlook] wrote:
Re: losing mail body content after close event of mailItem
Where does your code run? Disappears the text only after sending th
message
--
Viele Gruesse / Best regard
Michael Bauer - MVP Outloo
Organize eMails
<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6
Am Tue, 21 Aug 2007 09:36:02 -0700 schrieb nana
it
<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>
On Wednesday, August 22, 2007 5:10 AM
nan wrote:
Re: losing mail body content after close event of mailItem
Hallo Michael
I do not actually send the message, I just want to create a message in the
sent folder.
I have tested with several case
1
When I call the following code, after Close, the text disappear
OutLookApplication = new ActiveXObject("Outlook.Application")
MailItem = OutLookApplication.GetNamespace("MAPI").GetItemFromID(ItemID);
MailItem.HTMLBody = "<HTML><HEAD></HEAD>
<BODY>HELLO</BODY></HTML>";
MailItem.Close(olSave);
2)
When I call
OutLookApplication = new ActiveXObject("Outlook.Application");
MailItem = OutLookApplication.GetNamespace("MAPI").GetItemFromID(ItemID);
MailItem.HTMLBody = "<HTML><HEAD></HEAD>
<BODY>HELLO</BODY></HTML>";
MailItem.Save( );
the body was there at the beginning and gone afterwards, not really sure
what triggers that.
3)
But if I call
OutLookApplication = new ActiveXObject("Outlook.Application");
MailItem = OutLookApplication.GetNamespace("MAPI").GetItemFromID(ItemID);
MailItem.HTMLBody = "<HTML><HEAD></HEAD>
<BODY>HELLO</BODY></HTML>";
MailItem.Close(olSave);
MailItem.HTMLBody = "<HTML><HEAD></HEAD>
<BODY>HELLO</BODY></HTML>";
MailItem.Save( );
By repeatingly updating the HTMLBody, this seems to be functioning.
In my opinion, this is not logical at all.
4)
I have also tried just to call
OutLookApplication = new ActiveXObject("Outlook.Application");
MailItem =
OutLookApplication.GetNamespace("MAPI").GetItemFromID(ItemID);
MailItem.Close(olSave);
MailItem.HTMLBody = "<HTML><HEAD></HEAD>
<BODY>HELLO</BODY></HTML>";
MailItem.Save( );
But this also doesn't work, so from my debugging experience, I have to set
the HTMLBody twice.
Do you think it's a MAPI API problem?
Vielen Dank f??r Ihre Hilfe!
"Michael Bauer [MVP - Outlook]" wrote:
On Thursday, August 23, 2007 1:21 AM
Michael Bauer [MVP - Outlook] wrote:
Re: losing mail body content after close event of mailItem
Really seems not logical. I wonder why you don't need a Set statement for
setting the object variables. So again, does the code run within the Outlook
VBA environment (obviously not) or anywhere else?
--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Organize eMails:
<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>
Am Wed, 22 Aug 2007 02:10:01 -0700 schrieb nana:
OutLookApplication.GetNamespace("MAPI").GetItemFromID(ItemID);
OutLookApplication.GetNamespace("MAPI").GetItemFromID(ItemID);
OutLookApplication.GetNamespace("MAPI").GetItemFromID(ItemID);
<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>
<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>
the
been
charset=iso-8859-1">
6.5.7036.0">
work
On Thursday, August 23, 2007 5:12 AM
nan wrote:
Re: losing mail body content after close event of mailItem
Hello Michael,
It is not running in the VBA environment, but on the web browser, and I am
using JavaScript for it.
"Michael Bauer [MVP - Outlook]" wrote:
On Friday, August 24, 2007 1:29 AM
Michael Bauer [MVP - Outlook] wrote:
Re: losing mail body content after close event of mailItem
Sorry, I don't know what's going on and I don't know anythign about
JavaScript.
Maybe you can and have to live with this workaround:
MailItem.HTMLBody=""
MailItem.Save
MailItem.HTMLBody="Hello"
MailItem.Save
Again, you don't need to write all the basic HTML stuff.
--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Organize eMails:
<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>
Am Thu, 23 Aug 2007 02:12:02 -0700 schrieb nana:
Outlook
<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>
the
set
<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>
is
close
<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>
by
Submitted via EggHeadCafe - Software Developer Portal of Choice
WPF Report Engine, Part 2
http://www.eggheadcafe.com/tutorials/aspnet/0ad2fa61-7f0c-485f-92c9-cf3a9ee210a7/wpf-report-engine-part-2.aspx