Readline method and msg files

Author Message
RobDanaflex

  • Total Posts : 1
  • Scores: 0
  • Reward points : 0
  • Joined: 3/15/2011
  • Location: New Zealand
  • Status: offline
Readline method and msg files Tuesday, March 15, 2011 12:51 PM (permalink)
0
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>
 
#1

    Online Bookmarks Sharing: Share/Bookmark

    Jump to:

    Current active users

    There are 0 members and 1 guests.

    Icon Legend and Permission

    • New Messages
    • No New Messages
    • Hot Topic w/ New Messages
    • Hot Topic w/o New Messages
    • Locked w/ New Messages
    • Locked w/o New Messages
    • Read Message
    • Post New Thread
    • Reply to message
    • Post New Poll
    • Submit Vote
    • Post reward post
    • Delete my own posts
    • Delete my own threads
    • Rate post

    2000-2012 ASPPlayground.NET Forum Version 3.9