A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Tags: , ,

Saving HTML attachments





 
 
Thread Tools Display Modes
  #21  
Old December 29th 07, 08:05 PM posted to microsoft.public.outlook.program_vba
Shay Levi
external usenet poster
 
Posts: 15
Default Saving HTML attachments


True... all attachments type are olEmbeddeditem items. Can you elaborate
a bit
on Application.CreateItemFromTemplate? I'm not familiar with it and not sure
how can
use it to turn the embedded attachment into readable text, I don't mind losing
the sender or other properties as long as I can export its content to a readable
text file.

BTW, prior to Exchange 2007 I had no problems.

I'm also going to take a closer look on RDOMail (which is already opened
in IE :-).


Thanks!

-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic



It is an embedded message attachment that happens to have HTML body.
Check the the Attachment.Type property before saving attachments. If
it is
olEmbeddeditem (5), you have an embedded message and you wiull have an
MSG
file when you call SaveAsFile. You can try to import it back to
Outlook
using Application.CreateItemFromTemplate, but it will skip any sender
related properties.
plug Redemption exposes RDOAttachment.EmbeddedMsg property (returns
RDOMail object) which you can use to call RDOMail.SaveAs ..., olHTML
/plug
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Shay Levi" wrote in message
om...

Sorry, I may have used the wrong "outlook/attachment" terms for that
attachment. I don't know the exact definition (envelop???).
Anyway, see the attached jpg, It shows how I see it in Outlook 2007.
When
I double click it
it opens inside outlook's message windows and I can see the HTML page
the
message contains. When I say HTML, it's
like any HTML webpage.
-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic
That can only mean that the attachment is an embedded message, not
an
HTML
attachment.
What makes you think that you have an HTML attachment?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Shay Levi" wrote in message
om...
file.Attachments.Item(1).SaveAsFile("message.txt") ;

-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic
How *exactly* do you save the messages?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Shay Levi" wrote in message
om...
Thanks Dmitry, any suggestion on how to turn it into text file?

-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic
That looks like an MSG file (which is an OLE storage file).

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Shay Levi" wrote in message
om...
Thanks Ken,

When I double click the attachment it opens inside outlook.
here's a sample text from the saved msg file:

(...)
?????????????????????????????????????????????????? ?????????????
??
??
??
??????????????????????????R
o o t E n t r y
? ? ????????
p[?~?G??
?? _ _ p r o p e r t i e s _ v e r s i o n 1 . 0
0
??? ? ???? J P?
_ _ n a m e i d _ v e r s i o n 1 . 0
(
??????????/ ???}?G???_?}?G?? _ _ s u b s
t g 1 . 0 _ 0 E 0 4 0 0 1 F * ??????#
????
?
. ? ????????????? ?
? I ????( ? ? ? ? ? ¶ § ? ? ? ? ?
?
?
?
? ? ! " # $ % & ' ????A * + ,
- . / 0 1 2 3 4 5 6 7 8 9 : ;
=
?
@ ????B C D E F G H M J K L ????N O
P
?????????????????????????????????????????????????? ?????????????
??
??
??
?????????????????????????????????????????????????? ?????????????
??
(...)
One thing I did not mention, I could save the HTML attachents
to
readable
text files when my Exchange server was v2003, I think
the problem started when I switched to Exchange 2007.
Is there any configuration I can set in Outlook to resolve this
(Mail
Format, Mail Setup Tabs)?
-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic
You can't open an attachment programmatically, so that option
isn't available for code. It's possible that the text file
contains text in Unicode, where every other character would be
0x00 for Western character sets. You'll have to figure out how
the text file is encoded and how to decode that into readable
text or an alternative is to see what program opens the file
when you open it in the UI and then automate that program to
open the attachment file saved to the file system.

"Shay Levi" wrote in message
om...
Thanks Ken,

I already tried it. The text file contains unreadable
characters(binary
encoding???).
Even if I manually (GUI) save the attachment to disk (.msg or
.txt)
the
text file is still unreadable.
The only solution I found is to view the attachment in
Outlook
and
then
save the source to disk.
The problem is I get, at list, 25 emails per a day and
manually
proccesing
each one is painfull!
The only solution I found is to double click it (don't use
the
preview
option) and from file menu save
the file as HTML.
Can this steps be automated with a Macro? If so, can one
suggest
one.
-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog:
http://blogs.microsoft.co.il/blogs/scriptfanatic



Ads
  #22  
Old December 29th 07, 09:43 PM posted to microsoft.public.outlook.program_vba
Shay Levi
external usenet poster
 
Posts: 15
Default Saving HTML attachments


Dmitry,

I would like to thank you for your help. RDOMail did the trick.

Thanks!!!

-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic



It is an embedded message attachment that happens to have HTML body.
Check the the Attachment.Type property before saving attachments. If
it is
olEmbeddeditem (5), you have an embedded message and you wiull have an
MSG
file when you call SaveAsFile. You can try to import it back to
Outlook
using Application.CreateItemFromTemplate, but it will skip any sender
related properties.
plug Redemption exposes RDOAttachment.EmbeddedMsg property (returns
RDOMail object) which you can use to call RDOMail.SaveAs ..., olHTML
/plug
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Shay Levi" wrote in message
om...

Sorry, I may have used the wrong "outlook/attachment" terms for that
attachment. I don't know the exact definition (envelop???).
Anyway, see the attached jpg, It shows how I see it in Outlook 2007.
When
I double click it
it opens inside outlook's message windows and I can see the HTML page
the
message contains. When I say HTML, it's
like any HTML webpage.
-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic
That can only mean that the attachment is an embedded message, not
an
HTML
attachment.
What makes you think that you have an HTML attachment?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Shay Levi" wrote in message
om...
file.Attachments.Item(1).SaveAsFile("message.txt") ;

-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic
How *exactly* do you save the messages?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Shay Levi" wrote in message
om...
Thanks Dmitry, any suggestion on how to turn it into text file?

-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic
That looks like an MSG file (which is an OLE storage file).

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Shay Levi" wrote in message
om...
Thanks Ken,

When I double click the attachment it opens inside outlook.
here's a sample text from the saved msg file:

(...)
?????????????????????????????????????????????????? ?????????????
??
??
??
??????????????????????????R
o o t E n t r y
? ? ????????
p[?~?G??
?? _ _ p r o p e r t i e s _ v e r s i o n 1 . 0
0
??? ? ???? J P?
_ _ n a m e i d _ v e r s i o n 1 . 0
(
??????????/ ???}?G???_?}?G?? _ _ s u b s
t g 1 . 0 _ 0 E 0 4 0 0 1 F * ??????#
????
?
. ? ????????????? ?
? I ????( ? ? ? ? ? ¶ § ? ? ? ? ?
?
?
?
? ? ! " # $ % & ' ????A * + ,
- . / 0 1 2 3 4 5 6 7 8 9 : ;
=
?
@ ????B C D E F G H M J K L ????N O
P
?????????????????????????????????????????????????? ?????????????
??
??
??
?????????????????????????????????????????????????? ?????????????
??
(...)
One thing I did not mention, I could save the HTML attachents
to
readable
text files when my Exchange server was v2003, I think
the problem started when I switched to Exchange 2007.
Is there any configuration I can set in Outlook to resolve this
(Mail
Format, Mail Setup Tabs)?
-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic
You can't open an attachment programmatically, so that option
isn't available for code. It's possible that the text file
contains text in Unicode, where every other character would be
0x00 for Western character sets. You'll have to figure out how
the text file is encoded and how to decode that into readable
text or an alternative is to see what program opens the file
when you open it in the UI and then automate that program to
open the attachment file saved to the file system.

"Shay Levi" wrote in message
om...
Thanks Ken,

I already tried it. The text file contains unreadable
characters(binary
encoding???).
Even if I manually (GUI) save the attachment to disk (.msg or
.txt)
the
text file is still unreadable.
The only solution I found is to view the attachment in
Outlook
and
then
save the source to disk.
The problem is I get, at list, 25 emails per a day and
manually
proccesing
each one is painfull!
The only solution I found is to double click it (don't use
the
preview
option) and from file menu save
the file as HTML.
Can this steps be automated with a Macro? If so, can one
suggest
one.
-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog:
http://blogs.microsoft.co.il/blogs/scriptfanatic



  #23  
Old December 30th 07, 12:19 AM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 1,596
Default Saving HTML attachments

olEmbeddeditem is just onbe of the possible attachment types. Others are
olByValue (1), olByReference(4), olOLE (6).
CreateItemFromTemplate simply lets you create a new message from an MSG
file, this way you will have access to the MailItem.SaveAs method.
The downside is that you need to create an intermediate MSG file and then
import it back to begin with rather than work with the original embedded
message attachment (that is what Redemption lets you do).

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

"Shay Levi" wrote in message
om...

True... all attachments type are olEmbeddeditem items. Can you elaborate a
bit
on Application.CreateItemFromTemplate? I'm not familiar with it and not
sure how can
use it to turn the embedded attachment into readable text, I don't mind
losing
the sender or other properties as long as I can export its content to a
readable text file.

BTW, prior to Exchange 2007 I had no problems.

I'm also going to take a closer look on RDOMail (which is already opened
in IE :-).


Thanks!

-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic



It is an embedded message attachment that happens to have HTML body.
Check the the Attachment.Type property before saving attachments. If
it is
olEmbeddeditem (5), you have an embedded message and you wiull have an
MSG
file when you call SaveAsFile. You can try to import it back to
Outlook
using Application.CreateItemFromTemplate, but it will skip any sender
related properties.
plug Redemption exposes RDOAttachment.EmbeddedMsg property (returns
RDOMail object) which you can use to call RDOMail.SaveAs ..., olHTML
/plug
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Shay Levi" wrote in message
om...

Sorry, I may have used the wrong "outlook/attachment" terms for that
attachment. I don't know the exact definition (envelop???).
Anyway, see the attached jpg, It shows how I see it in Outlook 2007.
When
I double click it
it opens inside outlook's message windows and I can see the HTML page
the
message contains. When I say HTML, it's
like any HTML webpage.
-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic
That can only mean that the attachment is an embedded message, not
an
HTML
attachment.
What makes you think that you have an HTML attachment?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Shay Levi" wrote in message
om...
file.Attachments.Item(1).SaveAsFile("message.txt") ;

-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic
How *exactly* do you save the messages?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Shay Levi" wrote in message
om...
Thanks Dmitry, any suggestion on how to turn it into text file?

-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic
That looks like an MSG file (which is an OLE storage file).

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Shay Levi" wrote in message
om...
Thanks Ken,

When I double click the attachment it opens inside outlook.
here's a sample text from the saved msg file:

(...)
?????????????????????????????????????????????????? ?????????????
??
??
??
??????????????????????????R
o o t E n t r y
? ? ????????
p[?~?G??
?? _ _ p r o p e r t i e s _ v e r s i o n 1 . 0
0
??? ? ???? J P?
_ _ n a m e i d _ v e r s i o n 1 . 0
(
??????????/ ???}?G???_?}?G?? _ _ s u b s
t g 1 . 0 _ 0 E 0 4 0 0 1 F * ??????#
????
?
. ? ????????????? ?
? I ????( ? ? ? ? ? ¶ § ? ? ? ? ?
?
?
?
? ? ! " # $ % & ' ????A * + ,
- . / 0 1 2 3 4 5 6 7 8 9 : ;
=
?
@ ????B C D E F G H M J K L ????N O
P
?????????????????????????????????????????????????? ?????????????
??
??
??
?????????????????????????????????????????????????? ?????????????
??
(...)
One thing I did not mention, I could save the HTML attachents
to
readable
text files when my Exchange server was v2003, I think
the problem started when I switched to Exchange 2007.
Is there any configuration I can set in Outlook to resolve this
(Mail
Format, Mail Setup Tabs)?
-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic
You can't open an attachment programmatically, so that option
isn't available for code. It's possible that the text file
contains text in Unicode, where every other character would be
0x00 for Western character sets. You'll have to figure out how
the text file is encoded and how to decode that into readable
text or an alternative is to see what program opens the file
when you open it in the UI and then automate that program to
open the attachment file saved to the file system.

"Shay Levi" wrote in message
om...
Thanks Ken,

I already tried it. The text file contains unreadable
characters(binary
encoding???).
Even if I manually (GUI) save the attachment to disk (.msg or
.txt)
the
text file is still unreadable.
The only solution I found is to view the attachment in
Outlook
and
then
save the source to disk.
The problem is I get, at list, 25 emails per a day and
manually
proccesing
each one is painfull!
The only solution I found is to double click it (don't use
the
preview
option) and from file menu save
the file as HTML.
Can this steps be automated with a Macro? If so, can one
suggest
one.
-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog:
http://blogs.microsoft.co.il/blogs/scriptfanatic





  #24  
Old December 30th 07, 12:19 AM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 1,596
Default Saving HTML attachments

Cool!

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

"Shay Levi" wrote in message
om...

Dmitry,

I would like to thank you for your help. RDOMail did the trick.

Thanks!!!

-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic



It is an embedded message attachment that happens to have HTML body.
Check the the Attachment.Type property before saving attachments. If
it is
olEmbeddeditem (5), you have an embedded message and you wiull have an
MSG
file when you call SaveAsFile. You can try to import it back to
Outlook
using Application.CreateItemFromTemplate, but it will skip any sender
related properties.
plug Redemption exposes RDOAttachment.EmbeddedMsg property (returns
RDOMail object) which you can use to call RDOMail.SaveAs ..., olHTML
/plug
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Shay Levi" wrote in message
om...

Sorry, I may have used the wrong "outlook/attachment" terms for that
attachment. I don't know the exact definition (envelop???).
Anyway, see the attached jpg, It shows how I see it in Outlook 2007.
When
I double click it
it opens inside outlook's message windows and I can see the HTML page
the
message contains. When I say HTML, it's
like any HTML webpage.
-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic
That can only mean that the attachment is an embedded message, not
an
HTML
attachment.
What makes you think that you have an HTML attachment?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Shay Levi" wrote in message
om...
file.Attachments.Item(1).SaveAsFile("message.txt") ;

-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic
How *exactly* do you save the messages?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Shay Levi" wrote in message
om...
Thanks Dmitry, any suggestion on how to turn it into text file?

-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic
That looks like an MSG file (which is an OLE storage file).

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Shay Levi" wrote in message
om...
Thanks Ken,

When I double click the attachment it opens inside outlook.
here's a sample text from the saved msg file:

(...)
?????????????????????????????????????????????????? ?????????????
??
??
??
??????????????????????????R
o o t E n t r y
? ? ????????
p[?~?G??
?? _ _ p r o p e r t i e s _ v e r s i o n 1 . 0
0
??? ? ???? J P?
_ _ n a m e i d _ v e r s i o n 1 . 0
(
??????????/ ???}?G???_?}?G?? _ _ s u b s
t g 1 . 0 _ 0 E 0 4 0 0 1 F * ??????#
????
?
. ? ????????????? ?
? I ????( ? ? ? ? ? ¶ § ? ? ? ? ?
?
?
?
? ? ! " # $ % & ' ????A * + ,
- . / 0 1 2 3 4 5 6 7 8 9 : ;
=
?
@ ????B C D E F G H M J K L ????N O
P
?????????????????????????????????????????????????? ?????????????
??
??
??
?????????????????????????????????????????????????? ?????????????
??
(...)
One thing I did not mention, I could save the HTML attachents
to
readable
text files when my Exchange server was v2003, I think
the problem started when I switched to Exchange 2007.
Is there any configuration I can set in Outlook to resolve this
(Mail
Format, Mail Setup Tabs)?
-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic
You can't open an attachment programmatically, so that option
isn't available for code. It's possible that the text file
contains text in Unicode, where every other character would be
0x00 for Western character sets. You'll have to figure out how
the text file is encoded and how to decode that into readable
text or an alternative is to see what program opens the file
when you open it in the UI and then automate that program to
open the attachment file saved to the file system.

"Shay Levi" wrote in message
om...
Thanks Ken,

I already tried it. The text file contains unreadable
characters(binary
encoding???).
Even if I manually (GUI) save the attachment to disk (.msg or
.txt)
the
text file is still unreadable.
The only solution I found is to view the attachment in
Outlook
and
then
save the source to disk.
The problem is I get, at list, 25 emails per a day and
manually
proccesing
each one is painfull!
The only solution I found is to double click it (don't use
the
preview
option) and from file menu save
the file as HTML.
Can this steps be automated with a Macro? If so, can one
suggest
one.
-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog:
http://blogs.microsoft.co.il/blogs/scriptfanatic





 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
saving all attachments where the some of the attachments have thesame name nosliwmada Outlook - General Queries 0 December 6th 07 04:48 PM
Saving an Outlook Email as HTML Robert Halford Outlook and VBA 1 October 25th 06 07:10 PM
Saving emails as an HTML file Garret Swayne Outlook - General Queries 3 August 14th 06 03:39 PM
saving attachments T Outlook Express 1 April 16th 06 05:16 PM
saving attachments tom Outlook - General Queries 2 April 10th 06 06:17 PM


All times are GMT +1. The time now is 12:08 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2008 Outlook Banter, part of the NewsgroupBanter project.
The comments are property of their posters.
Mortgage Calculator - Current Accounts - Mobile Phones - Credit Card - Turbo Tax