Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...