Saving Body Text From Attachments 
Author Message
 Saving Body Text From Attachments

I'm trying to use Visual Basic to save the body text of
attachments to a file.  I actually would prefer accessing
the data right from VB.  The files are all email
attachments that are attached to a single email item.  So
far, I've been able to access the folder, the email item,
and the attachment.  I'm now down to the level of an
Attachment Object:

     Dim Email_Attachment As Attachment
     Set Email_Attachment = itm.Attachments.Item(x)

The itm.Attachments is an Attachments Object (notice the
s) that holds a collection of individual Attachment
Objects.  The "X" is an iterated value that will increment
until x=count, where count is the number of attachments-1.
I want to find specific text values within the
Email_Attachment Object.  I've tried using CDO calls, but
the object I'm using is not recognized as a valid object.



Mon, 23 May 2005 04:05:55 GMT  
 Saving Body Text From Attachments
You cannot access the raw attachment data in Outlook Object Model, the best
you can do is to save the attachment to a file (Attachment.SaveAsFile), then
grab the data. Or you can use Redemption (url in my sig.) -
SafeAttachment.RawData will return the raw data as an array of bytes.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool


Quote:
> I'm trying to use visual basic to save the body text of
> attachments to a file.  I actually would prefer accessing
> the data right from VB.  The files are all email
> attachments that are attached to a single email item.  So
> far, I've been able to access the folder, the email item,
> and the attachment.  I'm now down to the level of an
> Attachment Object:

>      Dim Email_Attachment As Attachment
>      Set Email_Attachment = itm.Attachments.Item(x)

> The itm.Attachments is an Attachments Object (notice the
> s) that holds a collection of individual Attachment
> Objects.  The "X" is an iterated value that will increment
> until x=count, where count is the number of attachments-1.
> I want to find specific text values within the
> Email_Attachment Object.  I've tried using CDO calls, but
> the object I'm using is not recognized as a valid object.



Mon, 23 May 2005 04:27:21 GMT  
 Saving Body Text From Attachments

Thank you VERY much.  Your post was very helpful and now I can continue
with my program.  I must have missed SaveAsFile!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Mon, 23 May 2005 21:14:40 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Saving Item.body and item.attachment

2. Q: Attachment: How to insert filename of attachment in message body

3. Body text not saved

4. how can you save body text to a file

5. Reading text file attachments without saving to disk

6. vbCrLf after attachment - (not '.Body')

7. Body Layout with an Attachment

8. Retrieving attachments and body from .msg files using a standalone application

9. Html attachment visible in mailitem body

10. Attachments and the mail Body

11. Inserting attachments in body for RTF format.

12. Retrieve HTML body from attachment

 

 
Powered by phpBB® Forum Software