我编写了一个脚本来评估几个人的日历状态,并且我正在使用 Outlook 中的 FreeBusy 方法。 它工作正常并返回忙/闲状态。如果我使用 OIBusyStatus 选项,它也可以正常工作,但是当日历中的约会设置为“在其他地方工作”时,显然它返回值“5”。 检查 Microsoft FreeBusy、OIBusyStatus 的文档,该状态应该返回“4”。 然后,我不确定文档是否错误或值“5”意味着其他内容,但我找不到任何解释该值的文档。
这是因为我正在寻找一种方法来确定日历在同一时间段内的两个不同约会之间是否存在冲突。
我使用自己的日历做了一些测试,得出的结论是,所有状态都返回 Microsoft 文档中的值,但“Working Elsewhere”返回“5”。
这是我的应用程序示例:
startDate = #1/15/2024#
' Assign a new AppointmentItem object to the objMeeting variable
Set objMeeting = Application.CreateItem(olAppointmentItem)
' Set the properties of the meeting
With objMeeting
' Assign the subject of the meeting
.Subject = "Test meeting"
' Assign the location of the meeting
.Location = "Room 1"
' Assign the date and time of the start of the meeting
.Start = #1/15/2024#
' Assign the date and time of the end of the meeting
' .End = #1/25/2024#
' Assign the body of the meeting message
.Body = "This is a test meeting created by a macro."
' Assign the status of the meeting as requested
.MeetingStatus = olMeeting
End With
' Assign the Recipients object to the objRecipients variable
Set objRecipients = objMeeting.Recipients
objRecipients.Add (myemail)
For Each objRecipient In objRecipients
'Get the availability for each recipients
myVal = objRecipient.FreeBusy(startDate, 30, True)
Next
当我预约“在其他地方工作”时,变量“myVal”中出现值“5”。
我可以确认,在 VBA 中(在 Excel 版本 2302 中)返回 5(而不是 4)。