自动接受/自动暂定接受

时间:2016-06-23 09:18:47

标签: vba outlook

我想接受或暂时接受Outlook中的会议请求,具体取决于我当时是否开会。我已经制定了规则;据我所知,它运行VBA,但代码不起作用。我无法用它找到问题。

Sub AcceptDecline(oRequest As MeetingItem)

If oRequest.MessageClass <> "IPM.Schedule.Meeting.Request" Then
    Exit Sub 'if this messageclass isn't a meeting request
End If

Dim oAppt As AppointmentItem
Set oAppt = oRequest.GetAssociatedAppointment(True)

Dim myAcct As Outlook.Recipient
Dim myFB As String

Set myAcct = Session.CreateRecipient("roconnor@pattonair.com")

myFB = myAcct.FreeBusy(oAppt.Start, 5, False) 'gets the free or busy status of my calendar

Dim oResponse
Dim i As Long
Dim test As String

i = (TimeValue(oAppt.Start) * 288)
test = Mid(myFB, i - 2, (oAppt.Duration / 5) + 2)

If InStr(1, test, "1") Then
    Set oResponse = oAppt.Respond(olMeetingTentative, True)
    oResponse.Display
    oResponse.Send

Else
    Set oResponse = oAppt.Respond(olMeetingAccepted, True)
    oResponse.Display
    oResponse.Send
End If
End Sub

1 个答案:

答案 0 :(得分:1)

如果会议请求自动创建暂时接受的会议,则空闲忙表示您正忙。答案总是暂时接受。

文件&GT;选项 - &GT; MAIL-&GT;跟踪 - &GT;禁用:自动处理会议请求和对会议请求和民意调查的响应

https://www.msoutlook.info/question/do-not-automatically-accept-meeting-as-tentative

如果这不是问题,那么打开请求,该请求不会自动标记为暂定,并逐步执行:

Private Sub AcceptDecline_test()
    AcceptDecline ActiveInspector.currentItem
End Sub