PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook VBA Programming ASP CDO Code only works with Outlook open.

Reply

ASP CDO Code only works with Outlook open.

 
Thread Tools Rate Thread
Old 01-07-2003, 03:32 PM   #1
Aaron
Guest
 
Posts: n/a
Default ASP CDO Code only works with Outlook open.


ASP code attempts to create an appointment in the logged on user's
calendar.
All usernames and Exchange 5.5 aliases are equal. If outlook is open on
the
client and the code is executed, an appointment is added for that user.
However, if Outlook is not running and we attempt to add a calendar
appointment, nothing happens and I do not get any error messages. Any
ideas
would be appreciated.

Thanks,
Aaron

-------CODE------

Dim objSession
Dim objCalFold
Dim colAppts
Dim objNewAppt
Dim colRecips
Dim LogonUser
Dim objFolder
Dim pos

LogonUser = Request.ServerVariables("LOGON_USER")

pos = InStr(LogonUser, "\")
If pos > 0 Then
LogonUser = Mid(LogonUser, pos + 1)
Else
Response.write ("<p><b>Invalid user logon. Cannot perform
operation.</b><p>")
Exit Sub
End If

Set objSession = CreateObject("MAPI.Session")

If objSession Is Nothing Then
Response.write ("<p><b>Cannot establish MAPI session.</b><p>")
Exit Sub
End If


objSession.Logon "", "", False, True, 0, True, "proliant" & vbLf &
LogonUser

On Error Resume Next
Set objFolder = objSession.InBox

if objFOlder is Nothing then
Response.write ("<p><b>Cannot Logon.</b><p>")
Exit Sub
end if

Set objCalFold = objSession.GetDefaultFolder(0)
Set colAppts = objCalFold.Messages
Set objNewAppt = colAppts.Add

objNewAppt.Location = ""
objNewAppt.Subject = subject
objNewAppt.Text = Text
objNewAppt.StartTime = StartTime
objNewAppt.EndTime = StartTime

objNewAppt.Update True, True

objSession.Logoff

Set colRecips = Nothing
Set objNewAppt = Nothing
Set colAppts = Nothing
Set objCalFold = Nothing
Set objSession = Nothing

end sub
  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off