Outlook from ASP (or VBScript)

I have an ASP page that has the following code in it:

<HTML>

<script language="VBSCRIPT">

'Add Appointment to Outlook
'ex: onClick="NewAppointment 'Subject','Location','6/1/98 12:00 PM','30'"

Sub NewAppointment(strSubject, strLocation, strStart, strDuration)
   
      Dim App
    Dim MyNameSpace
    Dim AppointmentFolder
    Dim AppointmentItem
    Dim MailFolder
    Dim MailItem
   
    Set App = CreateObject("Outlook.Application")    
    Set MyNameSpace = App.GetNamespace("MAPI")
    MyNameSpace.Logon
   
    'Add Appointment
    Set AppointmentFolder = MyNameSpace.GetDefaultFolder(9) 'olFolderCalendar
    Set AppointmentItem = AppointmentFolder.Items.Add
    AppointmentItem.Subject = strSubject
    AppointmentItem.Location = strLocation
      AppointmentItem.Start = strStart
    AppointmentItem.Duration = strDuration
    AppointmentItem.Save
   
    'Send email
    Set MailFolder = MyNameSpace.GetDefaultFolder(4) 'olFolderInbox
    Set MailItem = MailFolder.Items.Add
    MailItem.To = "joeblow@somewhere.com"
    MailItem.Subject = "New Class Attendee for: " & strSubject
    MailItem.Body = "Date: " & strStart
    MailItem.Send
   
    'Cleanup
    Set App = Nothing
    Set MyNameSpace = Nothing
    Set AppointmentFolder = Nothing
    Set AppointmentItem = Nothing
    Set MailFolder = Nothing
    Set MailItem = Nothing

      Msgbox "This event was added to Outlook!"

end SUB

The problem is when it gets to this line:
Set App = CreateObject("Outlook.Application")

It gives me the following error message:
An exception of type "Microsoft VBScript runtime error: ActiveX component can't create object: 'Outlook Application" was not handled.
fatalerror080298Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mayhewCommented:
Usually what that means is that the dll's needed for Outlook either aren't installed on your server or they've become corrupt or need to be registered.

I would look to make those dll's are in place, in good shape and properly registered.
0
fatalerror080298Author Commented:
Yea..  They are fine because I can do the same type of thing from Visual Basic just fine..  (Creating Outlook application objects that is)...  I have a feeling I'm just doing it wrong...  But I don't know.. :(
0
nikhilhCommented:
Are you sure that the Visual Basic application works on the same machine as that of IIS?
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

fatalerror080298Author Commented:
Sorry it took so long to reply...  I got really busy with something else...  Yes, I can run that exact code in VB and get it to work just fine w/o problems...  (And it is on the same machine as well)
0
MasseyMCommented:
Have you tried Set App = Server.CreateObject("Outlook.Application")

rather than:
Set App = CreateObject("Outlook.Application")


You need to create the object on the server side...  ASP is processed serverside and then sends HTML in response to the request...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
meganhallCommented:
I looked at your solution in th ehope that it would help me. Can anyone help with this error. I would really appreciate it.

Server object error 'ASP 0196 : 80040154'

Cannot launch out of process component

/Mail.asp, line 25

Only InProc server components should be used. If you want to use LocalServer components, you must set the AspAllowOutOfProcComponents metabase setting. Please consult the help file for important considerations
0
MoondancerCommented:
This question was awarded, but never cleared due to the JSP-500 errors of that time.  It was "stuck" against userID -1 versus the intended expert whom you awarded.  This corrects the problem and the expert will now receive these points; points verified.

Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them.  If you are an EE Pro user, you can also choose Power Search to find all your open questions.

This is the Community Support link, if help is needed.  Also a question is posted there specific to these changes that apply to the experts here.  Also, I am including the link to our All Topics, since many new ones have recently been added.

http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
http://www.experts-exchange.com/jsp/zonesAll.jsp
 
Thank you,
Moondancer
Moderator @ Experts Exchange
0
clubzoneCommented:
this method "Server.CreateObject("Outlook.Application") " does nothing for me:

Server object, ASP 0177 (0x800401F3)
800401f3

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.