ASP CDO Code only works with Outlook open.

A

Aaron

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top