Saving HTML attachments

S

Shay Levi

Can anyone provide a macro for saving HTML attachments source as text files
in Outlook 2007?
 
K

Ken Slovak - [MVP - Outlook]

The only way to work with an attachment file is to save it to the file
system and manipulate it there. Use the Attachment.Save() method to do that,
from there on it's just file work.
 
S

Shay Levi

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.
 
K

Ken Slovak - [MVP - Outlook]

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.
 
S

Shay Levi

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)?
 
K

Ken Slovak - [MVP - Outlook]

Not that I know of and that doesn't look like any HTML I've ever seen. What
it is I have no idea but it looks more like a fragment of some binary file
that's code of some kind or other.
 
S

Shay Levi

Yup...

Thanks Ken, I appreciate your help. I'll keep on looking :)

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


Not that I know of and that doesn't look like any HTML I've ever seen.
What it is I have no idea but it looks more like a fragment of some
binary file that's code of some kind or other.

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/scriptfanati
 
D

Dmitry Streblechenko

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 said:
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.
 
S

Shay Levi

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
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.

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
 
D

Dmitry Streblechenko

How *exactly* do you save the messages?

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

Shay Levi said:
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
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.

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
 
S

Shay Levi

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
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
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.

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
 
A

Anil Kumar

Here is something you can try
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2039073&SiteID=1&mode=1

Shay Levi said:
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
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
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.

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
 
S

Shay Levi

Nope... same problem, the file is saved as .msg file and the content is unreadble.
I need to run
a script on the content and I can't, when it's encoded that way.


Thanks!

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


Here is something you can try
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2039073&SiteID=1
&mode=1
Shay Levi said:
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
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
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.

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
 
A

Anil Kumar

I hope you are not using encryption?

Shay Levi said:
Nope... same problem, the file is saved as .msg file and the content is unreadble.
I need to run
a script on the content and I can't, when it's encoded that way.


Thanks!

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


Here is something you can try
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2039073&SiteID=1
&mode=1
Shay Levi said:
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
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
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.

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
 
S

Shay Levi

Oh no :)

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


I hope you are not using encryption?

Shay Levi said:
Nope... same problem, the file is saved as .msg file and the content
is unreadble.
I need to run
a script on the content and I can't, when it's encoded that way.
Thanks!

-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic
Here is something you can try
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2039073&SiteID
=1
&mode=1
:
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
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
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.

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
 
A

Anil Kumar

and obviously you have tried with different HTML attachments? Test with a
smallest one with say 'Test' on it :)

Shay Levi said:
Oh no :)

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


I hope you are not using encryption?

Shay Levi said:
Nope... same problem, the file is saved as .msg file and the content
is unreadble.
I need to run
a script on the content and I can't, when it's encoded that way.
Thanks!

-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic
Here is something you can try
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2039073&SiteID
=1
&mode=1
:
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
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
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.

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
 
D

Dmitry Streblechenko

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 said:
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
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
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.

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
 
D

Dmitry Streblechenko

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 said:
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
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
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
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.

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
 
S

Shay Levi

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
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
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
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
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.

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top