I set up a web calendar in office 365 which is connected with "Data Sourse" with Access 2016. Also at the same time the local Outlook is "looking" on the web folder of calendar (outlook at office 365). All three Access (i.e. linked table)-web calendar-local calendar synchronize correctly when adding, changing or removing an appointment.
I would like to "trap" all of the above events and use in my database.
for that reason I added module with ModOutlookRespond
with code:
Public Sub Initialize_handler()
Set m_olapp = GetObject(, "Outlook.Application")
m_olapp.GetNamespace("MAPI").Logon "Microsoft Outlook"
Set m_olNameSpace = m_olapp.GetNamespace("MAPI")
'this allows us to capture an appoitment item change event
Set m_olAppoitmentItems = m_olNameSpace.GetDefaultFolder(olFolderCalendar).Items
Debug.Print "Connection Initialised"
End Sub
and added Initialize_handler()
on the Open
event of Main form.
On the Main form I added also the code:
Public WithEvents m_olapp As Outlook.Application
Public WithEvents m_olAppoitments As Outlook.Items
Public m_olNameSpace As Outlook.NameSpace
Private Sub m_olAppoitments_ItemAdd(ByVal Item As Object)
Debug.Print "Item has added" & Item.Subject
End Sub
I am getting so far only the Debug.Print "Connection Initialised"
but not a single time any message from Add
event (or any other I tried).
Any ideas what I can try?