当我手动进行日历提醒/约会时,我可以单击“邀请与会者”并选择要邀请的人,然后单击“发送”,每个人都会收到该日历提醒/约会。
我有以下代码以编程方式进行提醒,但它不会发送给预期的收件人。如果我在脚本运行后打开提醒并单击“邀请与会者”,我会看到列表中填满了我想向其发送提醒的人,所以我不确定为什么它实际上没有向其发送提醒他们。
任何人都可以为我阐明这一点吗?
Private Function CreateAppointment(SubjectStr As String, BodyStr As String, StartTime As Date, EndTime As Date, AllDay As Boolean)
Dim olApp As Outlook.Application
Dim Appt As Outlook.AppointmentItem
' Only create the reminder if there's no duplicate
If (CheckForDuplicates(SubjectStr) = False) Then
Set olApp = CreateObject("Outlook.Application")
Set Appt = olApp.CreateItem(olAppointmentItem)
Appt.Recipients.Add ("John Doe")
Appt.Recipients.ResolveAll
Appt.Subject = SubjectStr
Appt.Start = StartTime
Appt.End = EndTime
Appt.AllDayEvent = AllDay
Appt.Body = BodyStr
Appt.ReminderSet = True
Appt.Save
Appt.Send
End If
Set Appt = Nothing
Set olApp = Nothing
End Function