Use MS Access to Extract Outlook Calendar Appointments (1 Viewer)

dragnor

Registered User.
Local time
Today, 01:49
Joined
Jul 30, 2008
Messages
12
Hi Experts,

I'm have run into a wall :banghead:

I have been given a task on extracting all appointment from a certain number of Shared Calendars in Outlook 2013. I'm able to read the calendar entries but have two major issues.

First issue is that I can't get "Restrict" to work, so every time it is given me all entries :(

i'm using this code here:

Dim oOutlook As Outlook.Application
Dim oNs As Outlook.namespace
Dim appt As Outlook.AppointmentItem
Dim objOwner As Outlook.recipient
Dim str_sql As String
Dim STR_OWNER As String
Dim item_Start_date As String
Dim item_Start_time As String
Dim app_Start As Date
Dim app_End As Date
Dim FolderCal As Object
Dim i As Long
Dim strRestriction As String
Dim myStart As Date
Dim myEnd As Date
Const olFolderCalendar = 9
myStart = C_DATE
myEnd = C_DATE

strRestriction = "[Start] >= '" & Format(Date, "yyyy/mm/dd") & "' AND [Start] <= '" & Format(Date + 14, "yyyy/mm/dd") & "'"
Set oOutlook = New Outlook.Application
Set oNs = oOutlook.GetNamespace("MAPI")
STR_OWNER = "Thomas"
Set objOwner = oNs.CreateRecipient(STR_OWNER)
objOwner.Resolve
If objOwner.Resolved Then
Set FolderCal = oNs.GetSharedDefaultFolder(objOwner, olFolderCalendar)
End If
Set ItemsApt = FolderCal.Items
ItemsApt.IncludeRecurrences = True
ItemsApt.Sort "[Start]"
Set oItemsInDateRange = ItemsApt.Restrict(strRestriction)
oItemsInDateRange.IncludeRecurrences = True
oItemsInDateRange.Sort "[Start]"
For Each appt In oItemsInDateRange



Next issue i'm having is "Recurrences" :banghead:

The "Only" thing I want, is to take out all Recurrences on the dates they are actually planed in the calender and not only the master appointment start and end date :mad:

I have been searching the internet for two weeks now in order to get what I need, but have given up now, and that is why i'm seeking help here.

Many many thanks in advance!!!
 

ByteMyzer

AWF VIP
Local time
Yesterday, 17:49
Joined
May 3, 2004
Messages
1,409
Try changing the following code:
Code:
strRestriction = "[Start] >= '" & Format(Date, "mm/dd/yyyy hh:mm AMPM") _
    & "' AND [Start] <= '" & Format(Date + 14, "mm/dd/yyyy hh:mm AMPM") & "'"
 

Users who are viewing this thread

Top Bottom