【问题标题】:Deleting appointment from someone else's calendar从其他人的日历中删除约会
【发布时间】:2021-06-20 00:05:48
【问题描述】:

我有 Access VBA 代码,可以在三位技术同事的日历中创建约会。

If vbYes = MsgBox("Send Calendar Appointments?", vbYesNo) Then
    Dim outMail As Outlook.AppointmentItem
    Set outMail = Outlook.CreateItem(olAppointmentItem)
    outMail.Subject = "Lab Booking - " & FullName & " - for date " & Forms!frmLabSession_edit!BookingDate
    outMail.Mileage = Me.LabBooking_ID
    outMail.Location = Forms!frmLabSession_edit!frm_qryLabsBookedPerBooking_subform!RoomNo
    outMail.MeetingStatus = olMeeting
    outMail.Start = BookingDate & " " & TimeFrom
    outMail.End = BookingDate & " " & TimeTo
    outMail.ReminderMinutesBeforeStart = 21600
    outMail.RequiredAttendees = "Person1@tees.ac.uk; Person2@tees.ac.uk; Person3@tees.ac.uk" & Me.txtCCList
    outMail.Body = "You have received this notification with a 15 days countdown to cover periods of leave when you may not have received initial notification." & Chr$(13) & _
      Chr$(13) & Me.Notes
    outMail.Attachments.Add FileName
    outMail.Send
    Set outMail = Nothing
End If

我有根据主题行删除约会的代码,但我不知道如何添加收件人 - 其他日历用户 - 它只会将其从 my 日历中删除。

Dim objOutlook As Outlook.Application
Dim objNamespace As Outlook.NameSpace
Dim objFolder As Outlook.MAPIFolder
Dim objAppointment As Outlook.AppointmentItem
Dim lngDeletedAppointements As Long
Dim strSubject As String
Dim strLocation As String
Dim dteStartDate As Date
    
'******************************** Set Criteria for DELETION here ********************************
strSubject = "Lab Booking - " & FullName & " - for date " & Forms!frmLabSession_edit!BookingDate
strLocation = Forms!frmLabSession_edit!frm_qryLabsBookedPerBooking_subform!RoomNo
dteStartDate = BookingDate
'************************************************************************************************
    
Set objOutlook = Outlook.Application
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objFolder = objNamespace.GetDefaultFolder(olFolderCalendar)
    
For Each objAppointment In objFolder.Items
    If objAppointment.Subject = strSubject And objAppointment.Location = strLocation And _
      objAppointment.Start > dteStartDate Then
        objAppointment.Delete
        lngDeletedAppointements = lngDeletedAppointements + 1
    End If
Next
    
MsgBox lngDeletedAppointements & " appointment(s) DELETED.", vbInformation, "DETETE Appointments"

我如何在代码中声明或声明与会者的日历以从中删除项目,就像顶部代码发送他们一样?

我拥有删除他们日历的权限。我可以进入他们的日历并删除约会,所以应该不是权限问题。

【问题讨论】:

    标签: vba ms-access outlook


    【解决方案1】:

    您可以使用以下操作顺序取消会议并通知与会者:

    AppointmentItem.MeetingStatus = olMeetingCanceled
    AppointmentItem.Save
    AppointmentItem.Send
    AppointmentItem.Delete
    

    只需设置会议取消状态,即代表-预定的会议已取消。

    【讨论】:

    • 太棒了 - 非常感谢,效果很好!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-20
    相关资源
    最近更新 更多