I would like to add an appointment to the users outlook calendar using VBA, which both shows on the outlook application calendar from which the macro is executed, and also exists in the users shared folder on the exchange server (so that it is displayed on the user's smartphone calendar etc).
At the moment I can achieve either/or:
Set myOlApp = Application
Set myNamespace = myOlApp.GetNamespace("MAPI")
Set myFolder = myNamespace.GetDefaultFolder(olFolderCalendar)
Set exchFolder = myNamespace.GetSharedDefaultFolder(myOlApp.Session.CurrentUser, olFolderCalendar)
...
Set myAppointment = myOlApp.CreateItem(olAppointmentItem) 'shows in the executing application calendar
'OR
Set myAppointment = exchFolder.items.add(olAppointmentItem) 'shows in the smartphone calendar
'then set whatever details we want for the appointment
With myAppointment
.ReminderSet = False
.AllDayEvent = False
.Sensitivity = olNormal
.Subject = "on call"
.Start = onCall(i).Begin
.Duration = onCall(i).Duration
.Save
End With
Of course, the macro could loop through and create new appointments in both the default calendar folder and also the exchange server folder. However, given each appointment is assigned its own unique ID, this would be a real hack (that is, we end up with 2 appointments representing the same event, but each with a different unique ID).
Is there a way to have the same appointment instance added to the folders collection of both the defaultFolder and the sharedDefaultFolder? If not, is there a good way to ensure both versions of the appointment are exact clones, with the same unique identifiers etc?