I am working on a Planning tool in Access. I have managed to import my own Calendar and work with the appointments in it. However, what I really need is access to my shared calendar so I can check if my collegues are busy.
At the moment I use the following code to import my personal calendar:
Code:
Dim Outlook As Outlook.Application
DimnamespaceAs Outlook.namespace
Dim root As Outlook.MAPIFolder
Dim cal As Outlook.MAPIFolder
Dim Accepted AsString
Dim olRecipient As Outlook.Recipient
Dim item AsObject
Dim appt As Outlook.AppointmentItem
Dim rs As ADODB.Recordset
Set Outlook =New Outlook.Application
Setnamespace= Outlook.GetNamespace("MAPI")
Set root =namespace.GetFolderFromID("SomeMapIDiprobablyShouldntPostOnline")
'--Setting "Agenda" to other names in the root doesnt work--
Set cal = root.Folders.item("Agenda")
Set rs =New ADODB.Recordset
rs.ActiveConnection = CurrentProject.Connection
rs.Open "Appointments",, adOpenDynamic, adLockOptimistic
ForEach item In cal.Items
If item.Class= olAppointment Then
Set appt = item
rs.AddNew
rs("Start")= appt.Start
rs("End")= appt.End
rs("Subject")= appt.Subject
rs("Location")= appt.Location
rs("Duration")= appt.Duration
rs("Organizer")= appt.Organizer
rs("Attendees")= appt.Attendees
rs.Update
EndIf
Next item
rs.Close
I tried working with GetSharedDefaultFolder("recipient",Outlook.OlDefau ltFolders.olFolderCalendar) ...
Code:
Set Outlook =New Outlook.Application
Setnamespace= Outlook.GetNamespace("MAPI")
Set olRecipient =namespace.CreateRecipient("Collegue Name")
Set cal =namespace.GetSharedDefaultFolder(olRecipient, olFolderCalendar)
olRecipient.Resolve
...and different Recipient Objects but I can't get it to work. Any tips would be greatly appreciated.