|
|
|
date: Mon, 26 May 2008 18:27:05 +0200,
group: microsoft.public.exchange.applications
back
Error on deleting an appointment
I'm making a test application with VB6 SP5 and CDO 1.21 which create
appointments and then it tries to delete them. The application has an error
when it tries to access to user messages. Id' be very grateful if anyone
could help me. The code is the following:
strProfileInfo = g_cServidorExchange & vbLf & cMailbox
Set ObjSession = New Session
On Local Error Resume Next
ObjSession.Logon "", "", False, True, 0, True, strProfileInfo
If Err.Number <> 0 Then
cError = Err.Number & " " & Err.Description
Call AñadirDatosFicheroLog("Error on logon - Error: " & cError,
NIVEL_BAJO)
Err.Clear
Exit Function
End If
Set ObjCalendarFolder =
ObjSession.GetDefaultFolder(CdoDefaultFolderCalendar)
Set ObjAppointments = ObjCalendarFolder.Messages <- I get an error in
this line
For Each ObjOneAppointment In ObjAppointments
If ObjOneAppointment.Subject = "New SLExchange appointment" &
cMailbox Then
lPosicion = g_objArrayCita.Find(0, 0, ObjOneAppointment.ID)
If lPosicion >= 0 Then
g_objArrayCita.Delete 0, lPosicion
g_lCitas = g_lCitas - 1
End If
Call AñadirDatosFicheroLog("Deleting the appointment with
period: " & ObjOneAppointment.StartTime & " to " &
ObjOneAppointment.EndTime, NIVEL_NORMAL)
ObjOneAppointment.Delete
Exit For
End If
Next
Set ObjOneAppointment = Nothing
Set ObjAppointments = Nothing
Set ObjCalendarFolder = Nothing
ObjSession.Logoff
Set ObjSession = Nothing
date: Mon, 26 May 2008 18:27:05 +0200
author: Jose Enrique
Re: Error on deleting an appointment
What is ObjAppointments declared as?
If you step the code do you get a good logon and is ObjCalendarFolder a
valid CDO Folder object?
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
"Jose Enrique" wrote in message
news:eg61X10vIHA.5096@TK2MSFTNGP02.phx.gbl...
> I'm making a test application with VB6 SP5 and CDO 1.21 which create
> appointments and then it tries to delete them. The application has an
> error
> when it tries to access to user messages. Id' be very grateful if anyone
> could help me. The code is the following:
>
> strProfileInfo = g_cServidorExchange & vbLf & cMailbox
>
> Set ObjSession = New Session
> On Local Error Resume Next
> ObjSession.Logon "", "", False, True, 0, True, strProfileInfo
> If Err.Number <> 0 Then
> cError = Err.Number & " " & Err.Description
> Call AñadirDatosFicheroLog("Error on logon - Error: " & cError,
> NIVEL_BAJO)
> Err.Clear
> Exit Function
> End If
>
> Set ObjCalendarFolder =
> ObjSession.GetDefaultFolder(CdoDefaultFolderCalendar)
>
> Set ObjAppointments = ObjCalendarFolder.Messages <- I get an error in
> this line
>
> For Each ObjOneAppointment In ObjAppointments
> If ObjOneAppointment.Subject = "New SLExchange appointment" &
> cMailbox Then
> lPosicion = g_objArrayCita.Find(0, 0, ObjOneAppointment.ID)
> If lPosicion >= 0 Then
> g_objArrayCita.Delete 0, lPosicion
> g_lCitas = g_lCitas - 1
> End If
> Call AñadirDatosFicheroLog("Deleting the appointment with
> period: " & ObjOneAppointment.StartTime & " to " &
> ObjOneAppointment.EndTime, NIVEL_NORMAL)
> ObjOneAppointment.Delete
> Exit For
> End If
> Next
>
> Set ObjOneAppointment = Nothing
> Set ObjAppointments = Nothing
> Set ObjCalendarFolder = Nothing
>
> ObjSession.Logoff
>
> Set ObjSession = Nothing
>
>
date: Tue, 27 May 2008 09:20:44 -0400
author: Ken Slovak - [MVP - Outlook]
Re: Error on deleting an appointment
Thanks for answering. This is the declarations part of my code:
Dim ObjCalendarFolder As Folder
Dim ObjAppointments As Messages
Dim ObjAppointmentFilter As MessageFilter
Dim ObjOneAppointment As AppointmentItem
Dim strProfileInfo As String
Dim ObjSession As Session
"Ken Slovak - [MVP - Outlook]" escribió en el mensaje
news:OSeS1AAwIHA.3680@TK2MSFTNGP05.phx.gbl...
> What is ObjAppointments declared as?
>
> If you step the code do you get a good logon and is ObjCalendarFolder a
> valid CDO Folder object?
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Professional Programming Outlook 2007.
> Reminder Manager, Extended Reminders, Attachment Options.
> http://www.slovaktech.com/products.htm
>
>
> "Jose Enrique" wrote in message
> news:eg61X10vIHA.5096@TK2MSFTNGP02.phx.gbl...
> > I'm making a test application with VB6 SP5 and CDO 1.21 which create
> > appointments and then it tries to delete them. The application has an
> > error
> > when it tries to access to user messages. Id' be very grateful if
anyone
> > could help me. The code is the following:
> >
> > strProfileInfo = g_cServidorExchange & vbLf & cMailbox
> >
> > Set ObjSession = New Session
> > On Local Error Resume Next
> > ObjSession.Logon "", "", False, True, 0, True, strProfileInfo
> > If Err.Number <> 0 Then
> > cError = Err.Number & " " & Err.Description
> > Call AñadirDatosFicheroLog("Error on logon - Error: " & cError,
> > NIVEL_BAJO)
> > Err.Clear
> > Exit Function
> > End If
> >
> > Set ObjCalendarFolder =
> > ObjSession.GetDefaultFolder(CdoDefaultFolderCalendar)
> >
> > Set ObjAppointments = ObjCalendarFolder.Messages <- I get an error in
> > this line
> >
> > For Each ObjOneAppointment In ObjAppointments
> > If ObjOneAppointment.Subject = "New SLExchange appointment" &
> > cMailbox Then
> > lPosicion = g_objArrayCita.Find(0, 0, ObjOneAppointment.ID)
> > If lPosicion >= 0 Then
> > g_objArrayCita.Delete 0, lPosicion
> > g_lCitas = g_lCitas - 1
> > End If
> > Call AñadirDatosFicheroLog("Deleting the appointment with
> > period: " & ObjOneAppointment.StartTime & " to " &
> > ObjOneAppointment.EndTime, NIVEL_NORMAL)
> > ObjOneAppointment.Delete
> > Exit For
> > End If
> > Next
> >
> > Set ObjOneAppointment = Nothing
> > Set ObjAppointments = Nothing
> > Set ObjCalendarFolder = Nothing
> >
> > ObjSession.Logoff
> >
> > Set ObjSession = Nothing
> >
> >
>
date: Tue, 27 May 2008 17:47:13 +0200
author: Jose Enrique
|
|