By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,882 Members | 2,465 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,882 IT Pros & Developers. It's quick & easy.

Automating Outlook 2000

P: n/a
Hi all,

I'm trying to have an email message automatically generated when a button is
clicked on an asp.net web form. I'm using portions of the sample code from
http://msdn.microsoft.com/library/de...pplication.asp
to try and accomplish this. This code however, throws an error pretty much
right away at the "set OlNs = olApp.GetNamespace("MAPI")" line with an
invalid cast exception. Any suggestions on what could be causing this
and/or what other considerations should be made for using outlook from a web
form?

Thanks in advance,

Matt
Nov 18 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
page codebehind:

Imports System.Web.Mail
in the event sub for the button:
Dim mailMessage As New MailMessage()

with mailMessage
.To = ""
.From = ""
....
end with

Smtpmail.SmtpServer = "SERVERNAME HERE"
SmtpMail.Send(mailMessage)

"Matthew MacDonald" <ma******@hotmail.com> wrote in message news:OD**************@TK2MSFTNGP12.phx.gbl...
Hi all,

I'm trying to have an email message automatically generated when a button is
clicked on an asp.net web form. I'm using portions of the sample code from
http://msdn.microsoft.com/library/de...pplication.asp
to try and accomplish this. This code however, throws an error pretty much
right away at the "set OlNs = olApp.GetNamespace("MAPI")" line with an
invalid cast exception. Any suggestions on what could be causing this
and/or what other considerations should be made for using outlook from a web
form?

Thanks in advance,

Matt

Nov 18 '05 #2

P: n/a
Thanks, but that doesn't really answer the question. I need to use Outlook because I am going off of an exchange server for internal messaging. I also need to use outlook for other reasons, but that is beyond the scope of this post.

Thanks anyway though.
"Thomas Dodds" <th*********@hotmail.com> wrote in message news:OQ**************@tk2msftngp13.phx.gbl...
page codebehind:

Imports System.Web.Mail
in the event sub for the button:
Dim mailMessage As New MailMessage()

with mailMessage
.To = ""
.From = ""
....
end with

Smtpmail.SmtpServer = "SERVERNAME HERE"
SmtpMail.Send(mailMessage)

"Matthew MacDonald" <ma******@hotmail.com> wrote in message news:OD**************@TK2MSFTNGP12.phx.gbl...
Hi all,

I'm trying to have an email message automatically generated when a button is
clicked on an asp.net web form. I'm using portions of the sample code from
http://msdn.microsoft.com/library/de...pplication.asp
to try and accomplish this. This code however, throws an error pretty much
right away at the "set OlNs = olApp.GetNamespace("MAPI")" line with an
invalid cast exception. Any suggestions on what could be causing this
and/or what other considerations should be made for using outlook from a web
form?

Thanks in advance,

Matt

Nov 18 '05 #3

P: n/a
have you taken a look at: http://msdn.microsoft.com/vbasic/def...olomwvbnet.asp ?
"Matthew MacDonald" <ma******@hotmail.com> wrote in message news:OF**************@tk2msftngp13.phx.gbl...
Thanks, but that doesn't really answer the question. I need to use Outlook because I am going off of an exchange server for internal messaging. I also need to use outlook for other reasons, but that is beyond the scope of this post.

Thanks anyway though.
"Thomas Dodds" <th*********@hotmail.com> wrote in message news:OQ**************@tk2msftngp13.phx.gbl...
page codebehind:

Imports System.Web.Mail
in the event sub for the button:
Dim mailMessage As New MailMessage()

with mailMessage
.To = ""
.From = ""
....
end with

Smtpmail.SmtpServer = "SERVERNAME HERE"
SmtpMail.Send(mailMessage)

"Matthew MacDonald" <ma******@hotmail.com> wrote in message news:OD**************@TK2MSFTNGP12.phx.gbl...
Hi all,

I'm trying to have an email message automatically generated when a button is
clicked on an asp.net web form. I'm using portions of the sample code from
http://msdn.microsoft.com/library/de...pplication.asp
to try and accomplish this. This code however, throws an error pretty much
right away at the "set OlNs = olApp.GetNamespace("MAPI")" line with an
invalid cast exception. Any suggestions on what could be causing this
and/or what other considerations should be made for using outlook from a web
form?

Thanks in advance,

Matt

Nov 18 '05 #4

P: n/a
also: http://www.c-sharpcorner.com/Interne...hOutlookCB.asp
"Matthew MacDonald" <ma******@hotmail.com> wrote in message news:OF**************@tk2msftngp13.phx.gbl...
Thanks, but that doesn't really answer the question. I need to use Outlook because I am going off of an exchange server for internal messaging. I also need to use outlook for other reasons, but that is beyond the scope of this post.

Thanks anyway though.
"Thomas Dodds" <th*********@hotmail.com> wrote in message news:OQ**************@tk2msftngp13.phx.gbl...
page codebehind:

Imports System.Web.Mail
in the event sub for the button:
Dim mailMessage As New MailMessage()

with mailMessage
.To = ""
.From = ""
....
end with

Smtpmail.SmtpServer = "SERVERNAME HERE"
SmtpMail.Send(mailMessage)

"Matthew MacDonald" <ma******@hotmail.com> wrote in message news:OD**************@TK2MSFTNGP12.phx.gbl...
Hi all,

I'm trying to have an email message automatically generated when a button is
clicked on an asp.net web form. I'm using portions of the sample code from
http://msdn.microsoft.com/library/de...pplication.asp
to try and accomplish this. This code however, throws an error pretty much
right away at the "set OlNs = olApp.GetNamespace("MAPI")" line with an
invalid cast exception. Any suggestions on what could be causing this
and/or what other considerations should be made for using outlook from a web
form?

Thanks in advance,

Matt

Nov 18 '05 #5

P: n/a
That code crashed for me too with an Outlook Interface Failed error.
"Thomas Dodds" <th*********@hotmail.com> wrote in message news:u$*************@TK2MSFTNGP12.phx.gbl...
also: http://www.c-sharpcorner.com/Interne...hOutlookCB.asp
"Matthew MacDonald" <ma******@hotmail.com> wrote in message news:OF**************@tk2msftngp13.phx.gbl...
Thanks, but that doesn't really answer the question. I need to use Outlook because I am going off of an exchange server for internal messaging. I also need to use outlook for other reasons, but that is beyond the scope of this post.

Thanks anyway though.
"Thomas Dodds" <th*********@hotmail.com> wrote in message news:OQ**************@tk2msftngp13.phx.gbl...
page codebehind:

Imports System.Web.Mail
in the event sub for the button:
Dim mailMessage As New MailMessage()

with mailMessage
.To = ""
.From = ""
....
end with

Smtpmail.SmtpServer = "SERVERNAME HERE"
SmtpMail.Send(mailMessage)

"Matthew MacDonald" <ma******@hotmail.com> wrote in message news:OD**************@TK2MSFTNGP12.phx.gbl...
Hi all,

I'm trying to have an email message automatically generated when a button is
clicked on an asp.net web form. I'm using portions of the sample code from
http://msdn.microsoft.com/library/de...pplication.asp
to try and accomplish this. This code however, throws an error pretty much
right away at the "set OlNs = olApp.GetNamespace("MAPI")" line with an
invalid cast exception. Any suggestions on what could be causing this
and/or what other considerations should be made for using outlook from a web
form?

Thanks in advance,

Matt

Nov 18 '05 #6

P: n/a
Is there any reason why you would not be able to access the MAPI namespace
when using an exchange server?

"Matthew MacDonald" <ma******@hotmail.com> wrote in message
news:OD**************@TK2MSFTNGP12.phx.gbl...
Hi all,

I'm trying to have an email message automatically generated when a button is clicked on an asp.net web form. I'm using portions of the sample code from http://msdn.microsoft.com/library/de...pplication.asp to try and accomplish this. This code however, throws an error pretty much right away at the "set OlNs = olApp.GetNamespace("MAPI")" line with an
invalid cast exception. Any suggestions on what could be causing this
and/or what other considerations should be made for using outlook from a web form?

Thanks in advance,

Matt

Nov 18 '05 #7

P: n/a
OK, I had to take a break from this project for a while, but now I'm back on
it. I got the code to where it won't crash by instantiating everything as
objects and not trying to cast them. I also found some security settings
that I needed to change. The problem I'm having now (hopefully the last) is
how to deal with the Outlook Security Update warnings. In a regular windows
app, you can just click through them, but that's not an option with web
forms. How do I get around this using web forms? Thanks for the help.

Matt
"Matthew MacDonald" <ma******@hotmail.com> wrote in message
news:OD**************@TK2MSFTNGP12.phx.gbl...
Hi all,

I'm trying to have an email message automatically generated when a button is clicked on an asp.net web form. I'm using portions of the sample code from http://msdn.microsoft.com/library/de...pplication.asp to try and accomplish this. This code however, throws an error pretty much right away at the "set OlNs = olApp.GetNamespace("MAPI")" line with an
invalid cast exception. Any suggestions on what could be causing this
and/or what other considerations should be made for using outlook from a web form?

Thanks in advance,

Matt

Nov 18 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.