PC Review


Reply
Thread Tools Rate Thread

Open msg File to get Attachment details

 
 
chris
Guest
Posts: n/a
 
      9th Nov 2005
Hi,

I am have trouble opening an msg file that has attachments using CDO

My attachments are not loading correctly in the object model and
instead I get attachment added to the text body which is just a garbled
mess.

What I am trying to do is use CDO to open the msg file so I can look at
the number of attachments it has, but as the attachment is not loaded
into the attachments collection the count is not available to me. I am
using the following code to load the file:

Function LoadMessageFromFile(Path As String) As Message
Dim Stm As New Stream
Stm.Open
Stm.LoadFromFile Path
Dim iMsg As New CDO.Message
Dim iDsrc As IDataSource
Set iDsrc = iMsg
iDsrc.OpenObject Stm, "_Stream"
Set LoadMessageFromFile = iMsg
End Function

If anyone can help me I would appreciate it.

TIA

Chris

 
Reply With Quote
 
 
 
 
Sue Mosher [MVP-Outlook]
Guest
Posts: n/a
 
      10th Nov 2005
If your main concern is to get at the attachments, you can use the Outlook object model's Namespace.CreateItemFromTemplate method to create a new item that's a copy of the .msg item.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"chris" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> Hi,
>
> I am have trouble opening an msg file that has attachments using CDO
>
> My attachments are not loading correctly in the object model and
> instead I get attachment added to the text body which is just a garbled
> mess.
>
> What I am trying to do is use CDO to open the msg file so I can look at
> the number of attachments it has, but as the attachment is not loaded
> into the attachments collection the count is not available to me. I am
> using the following code to load the file:
>
> Function LoadMessageFromFile(Path As String) As Message
> Dim Stm As New Stream
> Stm.Open
> Stm.LoadFromFile Path
> Dim iMsg As New CDO.Message
> Dim iDsrc As IDataSource
> Set iDsrc = iMsg
> iDsrc.OpenObject Stm, "_Stream"
> Set LoadMessageFromFile = iMsg
> End Function
>
> If anyone can help me I would appreciate it.
>
> TIA
>
> Chris
>

 
Reply With Quote
 
chris
Guest
Posts: n/a
 
      10th Nov 2005
Thanks Sue

I am currently using the outlook object model to load these files and
handle the messages, but I need to find an alternative method to check
the attachment details because the outlook object model does not seem
to work all of the time - it does most of the time but occasionally
says it has no attachments when it should - and I would like to double
check using a different method, hence using CDO to load the msg file
and see if I can extract the data that way.

any ideas?

 
Reply With Quote
 
Sue Mosher [MVP-Outlook]
Guest
Posts: n/a
 
      10th Nov 2005
My only idea is that maybe there's something interesting about the attachments in the items that appear to have none -- like maybe they're blocked files.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"chris" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> Thanks Sue
>
> I am currently using the outlook object model to load these files and
> handle the messages, but I need to find an alternative method to check
> the attachment details because the outlook object model does not seem
> to work all of the time - it does most of the time but occasionally
> says it has no attachments when it should - and I would like to double
> check using a different method, hence using CDO to load the msg file
> and see if I can extract the data that way.
>
> any ideas?
>

 
Reply With Quote
 
chris
Guest
Posts: n/a
 
      11th Nov 2005
Do you now if it is actually possible to load the msg file into the CDO
object and retrieve the attachments??

Chris

 
Reply With Quote
 
Sue Mosher [MVP-Outlook]
Guest
Posts: n/a
 
      11th Nov 2005
No, I've never tried it. I've always used either Namespace.CreateItemFromTemplate or Redemption.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"chris" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> Do you now if it is actually possible to load the msg file into the CDO
> object and retrieve the attachments??
>
> Chris
>

 
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
file open/views/details set details as default xorren Microsoft Word Document Management 8 27th Jan 2009 09:51 PM
How can I get Create/Insert attachment dialog box to open in Details view by default???? Joe M Windows XP Configuration 8 23rd Aug 2004 09:43 PM
How can I get Create/Insert attachment dialog box to open in Details view by default???? Joe M Microsoft Windows 2000 8 23rd Aug 2004 09:43 PM
How can I get Create/Insert attachment dialog box to open in Details view by default???? Joe M Windows XP Basics 8 23rd Aug 2004 09:43 PM
How can I get Create/Insert attachment dialog box to open in Details view by default???? Joe M Microsoft Outlook Discussion 1 17th Aug 2004 04:40 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:08 PM.