Error when creating 247 appointments in exchange mailbox



Hello,

I try to create hundreds of appointments in the calendar with a link
to a contact.

This works without problems on pst stores. With exchange mailboxes it
works too in OL 2003 but in 2002 on the 247th item the following error
occurs:

run time error -284147707 (ef104005)
error when executing the operation

This message is translated from German because I have no English 2002.
The numbers are different from time to time. In the compiled add-in I
get the message "-2147467259: Automation Error Unknown Error".

Here is the used code:

Sub Test()
Call CreateAppointments(1, 230)
Call CreateAppointments(231, 500)
End Sub

Sub CreateAppointments(ByVal lngFrom As Long, ByVal lngTo As Long)

Dim objCalendar As Outlook.MAPIFolder
Dim objContacts As Outlook.Items

Dim objApp As Outlook.AppointmentItem
Dim lngIndex As Long

Set objContacts =
Outlook.Session.GetDefaultFolder(olFolderContacts).Items
Set objCalendar =
Outlook.Session.GetDefaultFolder(olFolderCalendar)

For lngIndex = lngFrom To lngTo
Set objApp = objCalendar.Items.Add
With objApp
.ReminderSet = False
.Subject = objContacts(lngIndex).Subject
Call .Links.Add(objContacts(lngIndex))
.Save
End With
Next

End Sub

The error occurs on the line "Call .Links.Add(objContacts(lngIndex))"
and if I press after the error message F5 the code will run for the
next 246 items and will stop then again. Without the Link.Add method
the code runs without any errors.

Maybe this is an Outlook bug, but may be some one knows a workarround.

Thanks for any help and/or suggestions.

Peter

.



Relevant Pages