PC Review


Reply
Thread Tools Rate Thread

Body disappears in 2002 when creating an item from a saves msgattachment

 
 
Peter Marchert
Guest
Posts: n/a
 
      30th Oct 2009
Hello,

I try to reference a message which is attached to an e-mail. I use the
following code to save the attachment first and then set a reference
to it:

Sub test()

Dim objReply As Outlook.MailItem
Dim objItem As Outlook.MailItem

Set objReply = Outlook.ActiveExplorer.Selection(1)

Call objReply.Attachments.Item(1).SaveAsFile("C:\test1.msg")
' open "C:\test1.msg" via windows explorer -> body is ok

Set objItem = Outlook.CreateItemFromTemplate("C:\test1.msg")
Debug.Print objItem.Body ' -> body is ok
Call objItem.SaveAs("C:\test2.msg", olMSG)
' open "C:\test2.msg" via windows explorer in 2002 -> body is
blank
' open "C:\test2.msg" via windows explorer in 2003/2007 -> body is
ok, but no PR_BODY property exists

Set objItem = Nothing
Set objReply = Nothing

End Sub

As you can see in the comments the body disappears when opening the
saved msg file in 2002.

If I use RDO the message is completely empty (e. g. subject):

Sub test2()

Dim objRDOMail As Object
Dim objRDOAtt As Object
Dim objRDOSession As Object

Set objRDOSession = CreateObject("Redemption.RDOSession")
objRDOSession.MAPIOBJECT = Outlook.Session.MAPIOBJECT

Set objReply = Outlook.ActiveExplorer.Selection(1)
Call objReply.Attachments.Item(1).SaveAsFile("C:\test1.msg")

Set objRDOMail = objRDOSession.CreateMessageFromMsgFile("C:
\test1.msg")
objRDOMail.SaveAs "C:\test2.msg"
' open "C:\test2.msg" via windows explorer in 2002 -> message is
blank

End Sub

I want to ask if there is a workarround or a simplier way to get the
reference to an attached message.

Thanks
Peter
 
Reply With Quote
 
 
 
 
Michael Bauer [MVP - Outlook]
Guest
Posts: n/a
 
      3rd Nov 2009


Hi Peter,

with RDO object you can directly open the attachment, you don't need to save
it as a file. Does that workaround the empty body?

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: <http://www.vboffice.net/product.html?pub=6&lang=en>


Am Fri, 30 Oct 2009 04:09:04 -0700 (PDT) schrieb Peter Marchert:

> Hello,
>
> I try to reference a message which is attached to an e-mail. I use the
> following code to save the attachment first and then set a reference
> to it:
>
> Sub test()
>
> Dim objReply As Outlook.MailItem
> Dim objItem As Outlook.MailItem
>
> Set objReply = Outlook.ActiveExplorer.Selection(1)
>
> Call objReply.Attachments.Item(1).SaveAsFile("C:\test1.msg")
> ' open "C:\test1.msg" via windows explorer -> body is ok
>
> Set objItem = Outlook.CreateItemFromTemplate("C:\test1.msg")
> Debug.Print objItem.Body ' -> body is ok
> Call objItem.SaveAs("C:\test2.msg", olMSG)
> ' open "C:\test2.msg" via windows explorer in 2002 -> body is
> blank
> ' open "C:\test2.msg" via windows explorer in 2003/2007 -> body is
> ok, but no PR_BODY property exists
>
> Set objItem = Nothing
> Set objReply = Nothing
>
> End Sub
>
> As you can see in the comments the body disappears when opening the
> saved msg file in 2002.
>
> If I use RDO the message is completely empty (e. g. subject):
>
> Sub test2()
>
> Dim objRDOMail As Object
> Dim objRDOAtt As Object
> Dim objRDOSession As Object
>
> Set objRDOSession = CreateObject("Redemption.RDOSession")
> objRDOSession.MAPIOBJECT = Outlook.Session.MAPIOBJECT
>
> Set objReply = Outlook.ActiveExplorer.Selection(1)
> Call objReply.Attachments.Item(1).SaveAsFile("C:\test1.msg")
>
> Set objRDOMail = objRDOSession.CreateMessageFromMsgFile("C:
> \test1.msg")
> objRDOMail.SaveAs "C:\test2.msg"
> ' open "C:\test2.msg" via windows explorer in 2002 -> message is
> blank
>
> End Sub
>
> I want to ask if there is a workarround or a simplier way to get the
> reference to an attached message.
>
> Thanks
> Peter

 
Reply With Quote
 
Peter Marchert
Guest
Posts: n/a
 
      4th Nov 2009
On 3 Nov., 21:21, "Michael Bauer [MVP - Outlook]" <m...@mvps.org>
wrote:

Hello Michael,

thanks for your reply.

I'm not sure. I tested a lot the last days but finally I have no
solution (the users of 2002 gets a message to do something by hand).

The code is not easy and at least I think with RDO the body was ok,
but I cannot send the message without error (I replace attachments in
the attached message with OOM after the send event had fired).

May be I try something at a later time with RDO, but it seems to me I
have to rewrite great parts of the code to implement this.

Thanks
Peter


> Hi Peter,
>
> with RDO object you can directly open the attachment, you don't need to save
> it as a file. Does that workaround the empty body?
>
> --
> Best regards
> Michael Bauer - MVP Outlook
>
> : Outlook Categories? Category Manager Is Your Tool
> : VBOffice Reporter for Data Analysis & Reporting
> : <http://www.vboffice.net/product.html?pub=6&lang=en>
>
> Am Fri, 30 Oct 2009 04:09:04 -0700 (PDT) schrieb Peter Marchert:
>
>
>
> > Hello,

>
> > I try to reference a message which is attached to an e-mail. I use the
> > following code to save the attachment first and then set a reference
> > to it:

>
> > Sub test()

>
> > Dim objReply As Outlook.MailItem
> > Dim objItem As Outlook.MailItem

>
> > Set objReply = Outlook.ActiveExplorer.Selection(1)

>
> > Call objReply.Attachments.Item(1).SaveAsFile("C:\test1.msg")
> > ' open "C:\test1.msg" via windows explorer -> body is ok

>
> > Set objItem = Outlook.CreateItemFromTemplate("C:\test1.msg")
> > Debug.Print objItem.Body ' -> body is ok
> > Call objItem.SaveAs("C:\test2.msg", olMSG)
> > ' open "C:\test2.msg" via windows explorer in 2002 -> body is
> > blank
> > ' open "C:\test2.msg" via windows explorer in 2003/2007 -> body is
> > ok, but no PR_BODY property exists

>
> > Set objItem = Nothing
> > Set objReply = Nothing

>
> > End Sub

>
> > As you can see in the comments the body disappears when opening the
> > saved msg file in 2002.

>
> > If I use RDO the message is completely empty (e. g. subject):

>
> > Sub test2()

>
> > Dim objRDOMail As Object
> > Dim objRDOAtt As Object
> > Dim objRDOSession As Object

>
> > Set objRDOSession = CreateObject("Redemption.RDOSession")
> > objRDOSession.MAPIOBJECT = Outlook.Session.MAPIOBJECT

>
> > Set objReply = Outlook.ActiveExplorer.Selection(1)
> > Call objReply.Attachments.Item(1).SaveAsFile("C:\test1.msg")

>
> > Set objRDOMail = objRDOSession.CreateMessageFromMsgFile("C:
> > \test1.msg")
> > objRDOMail.SaveAs "C:\test2.msg"
> > ' open "C:\test2.msg" via windows explorer in 2002 -> message is
> > blank

>
> > End Sub

>
> > I want to ask if there is a workarround or a simplier way to get the
> > reference to an attached message.

>
> > Thanks
> > Peter

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Body Disappears when replying =?Utf-8?B?RXJ3aW4gdmFuIGRlciBMZWU=?= Microsoft Outlook Discussion 3 26th Mar 2012 04:06 PM
Which event is triggered when user saves email item? Kasper Microsoft Outlook Program Addins 4 22nd Sep 2006 02:26 PM
email body disappears??? =?Utf-8?B?dG9wcHNjYXJkZ3V5?= Microsoft Outlook Discussion 0 14th Nov 2005 05:00 PM
Outlook 2003: Email body disappears when dragged into a Calendar item Drew Paik Microsoft Outlook Calendar 1 31st May 2004 09:10 PM
message body disappears scott Microsoft Outlook 0 7th Nov 2003 03:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:55 PM.