Outlook Express again!

  • Thread starter Thread starter Jason Huang
  • Start date Start date
J

Jason Huang

Hi,

I am not sure if we can call Outlook Express in the C# windows form project.
However, my boss he thinks that it should be able to open, since the VSC#
and Outlook Express are all MS's product,
but I'm not so sure.
In my C# Windows Form project, I would like to have a button which will
initiate the client's Outlook Express.
In the mean time, it needs to attach a particular document in the OE.
Would some one give me some advice?
Thanks for help.


Jason
 
Can't help you with attaching an attachment, as I don't believe OE can be
automated that easily without a third party tool. However, if the amount of
data is small and is text based, why not think about something like this:

string commandText = @"mailto:[email protected]?" +
"[email protected]&" +
"subject=Test email&" +
"body=Error located at <address>%0AOther stuff we need to
know%0A";

Process.Start(commandText);

You'll need to have a "using System.Diagnostics" to make this work. The body
of the message would be used to include any text you need to have sent. Just
remember to use "%0A" for newlines.

It might get you started. On my system, this opens the default mailer with
the to and cc fields filled in, a subject and the body completed. You can
see more amount the syntax of mailto: at
http://www.ianr.unl.edu/internet/mailto.html

Steve
 
Just start the OE? Start an external process from C# is an easy task...
Then check the OE docs if there is a parameter that allows you to send
some arguments at process start.
For example

System.Diagnostics.Process.Start"C:\Program\Outlook Express\msimn.exe",
"(/mailto:[email protected] /attachment:C:\temp\myattachment.doc ");

or something...

/Magnus (Check the msdn documentation for "Process Class")
 
"Magnus" <[email protected]> a écrit dans le message de (e-mail address removed)...

| Just start the OE? Start an external process from C# is an easy task...
| Then check the OE docs if there is a parameter that allows you to send
| some arguments at process start.
| For example
|
| System.Diagnostics.Process.Start"C:\Program\Outlook Express\msimn.exe",
| "(/mailto:[email protected] /attachment:C:\temp\myattachment.doc ");

If I remember rightly, if OE is your default mail client, then all you have
to do is call Process.Start with the "mailto" command parameters including
the attachment.

Joanna
 
unfortunately, OE is not part of the suite of Office products - its just a
free utility shipped with IE - so you don't have the freedom to automate it
using traditional means such as VSTO. However, OE is simply a COM server
with a well-defined API so you can use regular COM automation to explore the
internals.

--
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Professional VSTO.NET - Wrox/Wiley 2006
 
Back
Top