Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / JScript / July 2005

Tip: Looking for answers? Try searching our database.

use script read a .MSG file exported from Outlook

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bruce Hensley - 26 Jul 2005 18:23 GMT
I would like to write a script (JScript or VBScript) that parses fields (to,
from, subject) out of .MSG files that have already been saved to file system
files from Outlook.  The method I tried, automating Outlook.Application and
using CreateItemFromTemplate generates the security dialog box and has a
blank From field (since it is creating a new message).

Can this be done by an alternate method (perhaps using CDO, .Net)?  If so,
how?

Platform:

Windows 2000 (cdosys.dll)
Outlook 2000 SP3
.NET Framework 1.1

I have no administrative access to the Exchange Server, and its settings are
determined at the Corporate level.
Serge Baltic - 26 Jul 2005 19:44 GMT
Hello,

BH> I would like to write a script (JScript or VBScript) that parses
BH> fields (to, from, subject) out of .MSG files that have already been
BH> saved to file system files from Outlook.  The method I tried,
BH> automating Outlook.Application and using CreateItemFromTemplate
BH> generates the security dialog box and has a blank From field (since
BH> it is creating a new message).
BH>
BH> Can this be done by an alternate method (perhaps using CDO, .Net)?
BH> If so, how?

BH> .NET Framework 1.1

I think here you'll need PlatformInvoke so it's better to use something like
C# not JScript.NET. A MSG file is a compound document object, it's like a
filesystem inside a file. You may use any tool that browses a compound document
object AKA DocFile and see its contents. Most of the fields are just written
"AS IS" in the "files" of this container.

See functions like StgOpenDocFile in WinAPI, interfaces IStorage, IStream,
and so on.

As for a manual browsing utility, for example, I know that FAR Manager with
DocFile plugin is capable of viewing the structure, the "files" and "folders",
contents, and of copying those "files" into the real filesystem.

(H) Serg
Bruce Hensley - 26 Jul 2005 20:22 GMT
Serge,

Thanks.

C# is too far beyond my skill level.

And, I am new to .NET.  Do I understand you to say that it can be done in
JScript, with difficulty, using PlatformInvoke?

Thanks,
Bruce

> Hello,
>
[quoted text clipped - 24 lines]
>
> (H) Serge
Serge Baltic - 27 Jul 2005 13:19 GMT
Hello,

BH> C# is too far beyond my skill level.

As C# is a .NET language, there's no much difference with JScript.NET. So
it's not something like C++ with templates and so on. Basic level of C# is
simple enough and in some way it's a bit script-like, as it has a managed
runtime.

BH> And, I am new to .NET.  Do I understand you to say that it can be
BH> done in JScript, with difficulty, using PlatformInvoke?

I'm not sure whether JS.NET supports PlatformInvoke, probably it does not.

The approach of reading a MSG file as DocFile can only help with extracting
the attachments, body text and some basic properties like From and Subject.
This can be done relatively simply. For some complex tasks, you'd better
look towards MAPI.

(H) Serge
Sue Mosher [MVP-Outlook] - 26 Jul 2005 19:45 GMT
You can use Redemption's Import method. See http://www.outlookcode.com/codedetail.aspx?id=716 for sample code.

Signature

Sue Mosher, Outlook MVP
Author of
    Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

>I would like to write a script (JScript or VBScript) that parses fields (to,
> from, subject) out of .MSG files that have already been saved to file system
[quoted text clipped - 13 lines]
> I have no administrative access to the Exchange Server, and its settings are
> determined at the Corporate level.
Bruce Hensley - 26 Jul 2005 20:11 GMT
Sue,

Thanks for the response.

I should have mentioned that one of the constraints is no 3rd-party code or
utilities.

Thanks,
Bruce

You can use Redemption's Import method. See
http://www.outlookcode.com/codedetail.aspx?id=716 for sample code.

Signature

Sue Mosher, Outlook MVP
Author of
    Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

>I would like to write a script (JScript or VBScript) that parses fields (to,
> from, subject) out of .MSG files that have already been saved to file system
[quoted text clipped - 13 lines]
> I have no administrative access to the Exchange Server, and its settings are
> determined at the Corporate level.
Sue Mosher [MVP-Outlook] - 26 Jul 2005 20:20 GMT
Then your alternative is to write Extended MAPI code with C++ or Delphi (which is what Redemption does -- it's an ExMAPI wrapper). I have no specific information, however, on what the code for your application might look like, not being an ExMAPI programmer myself.

Note that this task is not possible at all with a scripting language.

Signature

Sue Mosher, Outlook MVP
Author of
    Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

> Sue,
>
[quoted text clipped - 30 lines]
> are
>> determined at the Corporate level.
Bruce Hensley - 26 Jul 2005 20:34 GMT
Thanks.

Bummer.  I don't do C or Delphi.  Scripting is pretty much it.

Could I open the MSG file and save it as text?  If so, I could parse the
text file using FileSystemObject.  The only fields I really need are From,
Date, and Subject, which should be available in a text representation.

Bruce

Then your alternative is to write Extended MAPI code with C++ or Delphi
(which is what Redemption does -- it's an ExMAPI wrapper). I have no
specific information, however, on what the code for your application might
look like, not being an ExMAPI programmer myself.

Note that this task is not possible at all with a scripting language.

Signature

Sue Mosher, Outlook MVP
Author of
    Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

> Sue,
>
[quoted text clipped - 32 lines]
> are
>> determined at the Corporate level.
Sue Mosher [MVP-Outlook] - 26 Jul 2005 22:52 GMT
Not without running into security prompts.

Signature

Sue Mosher, Outlook MVP
Author of
    Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

> Thanks.
>
[quoted text clipped - 51 lines]
>> are
>>> determined at the Corporate level.
Bruce Hensley - 26 Jul 2005 23:35 GMT
Sue,

Thanks.  I guess it's time to regroup.

Bruce

Not without running into security prompts.

Signature

Sue Mosher, Outlook MVP
Author of
    Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

> Thanks.
>
[quoted text clipped - 51 lines]
>> are
>>> determined at the Corporate level.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.