Hi,
I am trying to create an ASP that will read a msg file (as produced by MS Outlook).
I'm trying to use the Readline method of the FileSystemObject but am having no luck.
Here is the script I am using:
<%@ language="VBSCRIPT"%>
<%
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
Dim fso, ts, fileObj, TextLine, FileName, xx, f
Set fso = CreateObject("Scripting.FileSystemObject")
' Create the file, and obtain a file object for the file.
FileName = "c:\Temp\RE.msg"
Set fileObj = fso.GetFile(FileName)
' Open a text stream for input.
Set ts = fileObj.OpenAsTextStream(ForReading, TristateUseDefault)
' Read from the text stream and display the results.
Do While ts.AtEndOfStream <> True
TextLine = ts.ReadLine
Response.Write TextLine & "<br />"
Loop
ts.Close
%>
<html>
<body>
</body>
</html>
It does read the file but the output is not at all what I expect. Here is a snippet of what is produced by the ASP and comared to the first line when the file in question is openned in Notepad
The web page produced:
ÐÏࡱဤãÀset0 €ÿ²/O0_6ð<€ na›€%G ðat°¯!` 0 ðt%M f” W'Q (#Ð0 € €diu|m)-¾12p2á!ˆ--[ !m ]>
In notepad:
ÐÏࡱá > þÿ þÿÿÿ N O P ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
The first 8 characters are the same but thereafter it goes all haywire.
What I'm trying to do is read msg files and extract who they are from and what the subject is.
Hope someone can help
Thanks
Rob
<message edited by RobDanaflex on Tuesday, March 15, 2011 12:59 PM>