Well I thought I had this figured out, but I figured wrong.
I'm trying to export a Calendar object to an Access database through code. The problem is that most events are recurring events.
I could get the start date and number of occurences and frequency and add these records to the database, but what about exceptions to the occurrence. In some cases the description is different. Or may week 7 of a ten week recurrence has been deleted.
Here's my basic code for getting the record, but of course now this code will only get the first instance of a recurring appointment.
Dim ol As New Outlook.Application
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("Calendar")
Dim olns As Outlook.NameSpace
Dim cf As Outlook.MAPIFolder
Dim c As Outlook.AppointmentItem
Dim objItems As Outlook.Items
Set olns = ol.GetNamespace("MAPI")
Set cf = olns.Folders("PRC").Folders("Calendar")
Set objItems = cf.Items
iNumContacts = objItems.Count
If iNumContacts <> 0 Then
For i = 1 To iNumContacts
Set c = objItems(i)
If c.Sensitivity = olNormal Then 'ignore private records
rst!Subject = c.Subject
rst!StartDate = DateValue(c.Start)
rst!StartTime = TimeValue(c.Start)
rst!enddate = DateValue(c.End)
rst!EndTime = TimeValue(c.End)
rst!AllDayEvent = c.AllDayEvent
rst!Categories = c.Categories
rst!Description = c.Body
rst!Location = c.Location
MsgBox "No items to export."