473,397 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Automating Outlook 2000

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
7 1280
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Kurt | last post by:
Hi We are developing an off-the-shelf software suite for a certain business sector. Most of the program is simply a GUI on top of some .mdb files. Its a .net application written in c# One...
3
by: Lauren Wilson | last post by:
Hi folks, We have an Access 2000 app that is highly integrated with Outlook 2000 or later. The app allows the user to send predefined emails that are created through an Access form and stored...
1
by: Richard | last post by:
All, I am writing an Outlook 2000 Add-In .DLL program. I have applied the necessary knowledge base fixes to enable event handling in Outlook 2000 and everything is working except for one...
4
by: John | last post by:
Hi I would like my app to target outlook 2000 and above, but since two versions of outlook can not exist on the same machine, I only have outlook 2002. How can I develop for outlook 2000? ...
10
by: John | last post by:
Hi When I open a new outlook email from vb.net, sometimes outlook is very slow to appear or occasionally outlook freezes completely. I am targeting mixed office2000/xp environments so I am...
4
by: Supa Hoopsa | last post by:
I am in the process of rewriting an MS Access application (access front end with SQL 2k database) in VB.NET and one of the things I would like to do is link in to the compiled Access ADE so that I...
7
by: John | last post by:
Hi I am using the following code to automate outlook from within MS Access; Dim O As Object O = CreateObject("Outlook.Application") The problem is that I am getting the following error on...
5
by: Arno R | last post by:
Hi all, I need to get at specific (shared) agenda-data from MS outlook 2003. I need every day to get the scheduled 'appointments' for some rooms to Access. In Access I will show the...
2
by: Randy Harris | last post by:
I have an A2K app that generates a mail message in Outlook. It properly fills in the To and CC lines in Outlook, but Outlook doesn't attempt to resolve the names until the user manually changes...
0
by: brossyg | last post by:
I have some VBA code that creates an email in Access and sends it from Outlook. It is based on a query with a list of email addresses. It sends the first email to Outlook and then I have to manually...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.