ItemAdd不会触发iCloud日历项目

时间:2017-12-01 03:03:33

标签: vba outlook calendar icloud

我试图拦截添加约会到Outlook 2007中的iCloud日历,将提醒从18小时更改为30分钟。

添加约会不会触发“items_ItemAdd”子例程。

Private WithEvents Items As Outlook.Items

Private Sub Application_Startup()
  Dim Ns As Outlook.NameSpace

  Set Ns = Application.GetNamespace("MAPI")
  Set MyiCloudFolder = Ns.Folders("iCloud")
  Set Items = MyiCloudFolder.Folders("Calendar").Items
End Sub

Private Sub Items_ItemAdd(ByVal Item As Object)
  '*** this routine never gets called... can't figure out why ****
  On Error Resume Next
  Dim Appt As Outlook.AppointmentItem

  If TypeOf Item Is Outlook.AppointmentItem Then
    Set Appt = Item
    If Appt.ReminderMinutesBeforeStart = 1080 Then
     Appt.ReminderMinutesBeforeStart = 30
     Appt.Save
    End If
  End If
End Sub

我在调试中检查了“Items”对象,它实际上是iCloud日历。

0 个答案:

没有答案