
Calendar Folders and the CDO object model
My question concerns the CDO object model. (See the code below.) When I
use the cdoSession.GetDefaultFolder method, I get a MAPI.Folder object.
When I navigate the InfoStores as below, I get a MAPI.Folder object. When I
compare the folders, they are identical. However, when I create a new item
in the cdoDefCalendar folder, it is a MAPI.Appointment object, but when I
create a new item in the cdoCalendar folder, it is a MAPI.Message object.
This occurs even when I use intermediate variables for the collections. Can
anyone explain why this happens?
Thanks,
Pete Anfinsen
' First MAPI.Folder object
Set cdoDefCalendar = cdoSession.GetDefaultFolder(cdoDefaultFolderCalendar)
' Second MAPI.Folder object
For each cdoIS in cdoSession.InfoStores
For each cdoFolder in cdoIS.RootFolder.Folders
If cdoFolder.Name = "Calendar" then Set cdoCalendarFolder =
cdoFolder
Next
Next
' Compare them
If cdoDefCalendar.IsSameAs(cdoCalendar) then
msgbox "They're the same." ' msg displays
End If
' Add message to first
Set cdoDefAppt = cdoDefCalendar.Messages.Add
msgbox cdoDefAppt.Class ' 26 => MAPI.AppointmentItem
' Add message to second
Set cdoAppt = cdoCalendar.Messages.Add
msgbox cdoAppt.Class ' 3 => MAPI.Message