Problem writing to Exchange 2003 Calendar

rdlsz24

New member
Joined
Dec 6, 2005
Messages
2
Programming Experience
1-3
I have converted a VB6 application to be .net that gets appointments from a MySQL database and then writes them to several user's calendars in Exchange 2003. All is fine and dandy until the code goes to update a MAPI.AppointmentItem. Here is the declarations so you can see what is what and the part of the code that is erroring out:

PrivateFunction WriteAppointments(ByVal colCalendar As MAPI.Messages, ByVal aobjNewAppts As cAppointments, ByVal astrDocName AsString) AsBoolean

Dim objApptInfo As cApptInfo
Dim objAppt As MAPI.AppointmentItem
Dim objApptFields As MAPI.Fields
Dim objFld As MAPI.Field
DimlstrTempStart AsString
Dim lstrTempEnd AsString
DimlngCount AsLong
Dim lngTotal AsLong

With objAppt
.StartTime = CDate(lstrTempStart)
.EndTime = CDate(lstrTempEnd)
.Subject = objApptInfo.Subject
If objApptInfo.UseLocation Then .Location = objApptInfo.Location
.AllDayEvent = objApptInfo.AllDayEvent
.ReminderSet =
False

'Add custom field to identify these appointments at time of deletion
objApptFields = .Fields
objFld = objApptFields.Add("Crosswalk", MAPI.CdoFieldType.CdoString, objApptInfo.ApptType)

'Write the appointment
.Update(True)
EndWith

The part where I create the field "Crosswalk" is so the program knows whether or not to delete each appointment, since users can add personal appointments to the ones already coming in from MySQL.

The error occurs when the line ".Update(True)" is executed. This same line of code worked fine in VB6.

The error I'm receiving is -2147221240 and the description is [Collaboration Data Objects - [MAPI_E_INVALID_OBJECT(80040108)]]

Any ideas?

Thanks,
Rob
 
Back
Top