自动拒绝日历会议到特定电子邮件地址(通讯组列表 - 组)

问题描述 投票:0回答:1

我正在尝试创建一个 VBA,它将自动拒绝并删除从企业用户发送到特定电子邮件(DL/组)的所有日历邀请。 出于商业目的,我无法将自己从该组中删除以接收所有电子邮件,但这也会自动将邀请添加到我的日历中。

到目前为止我已经用过这个: https://www.extendoffice.com/documents/outlook/5054-outlook-auto-decline-meeting-from-specific-person.html

问题在于它指向:

If VBA.LCase(xMeeting.SenderEmailAddress) = VBA.LCase("[email protected]") Then

我找不到一个命令可以让我把它变成这样的东西: xMeeting.(接收者/接收者)电子邮件地址

这有可能做到吗?

此外,我使用的是 Outlook 365,在规则管理中没有选择“运行脚本”的选项。 还有其他办法吗?

它把我的日历搞乱了,我需要找到一种方法来做到这一点。

提前致谢!

创建规则:

  • 发送给个人或公共团体
  • 主题中包含特定词语
  • 这是会议邀请或更新

从上面的链接添加了 VBA 代码,但不知道如何将其更改为收件人而不是发件人。 也没有在规则中选择“运行脚本”的选项。

vba outlook office365 outlook-calendar meeting-request
1个回答
0
投票

我找不到允许我将其转换为以下内容的命令:xMeeting.(Receiver/Receipient)EmailAddress

听起来发件人电子邮件地址已经已知:

If VBA.LCase(xMeeting.SenderEmailAddress) = VBA.LCase("[email protected]") Then

要获取项目的收件人,您需要使用 Outlook 项目的相应属性 - Recipients 属性返回一个

Recipients
集合,表示 Outlook 项目的所有收件人。使用
Recipients(index)
(其中
index
是名称或索引号)返回单个
Recipient
对象。
MeetingItem
接收者可以是以下
OlMeetingRecipientType
常量之一:
olOptional
olOrganizer
olRequired
olResource
(请参阅
Type
属性)。例如:

Sub DemoMeetingRecipients() 
 Dim myAppointment As Outlook.AppointmentItem 
 Dim myPA As Outlook.PropertyAccessor 
 Dim d As Long 
 Dim myInt As Long 
 
 Set myAppointment = Application.ActiveInspector.CurrentItem 
 
 For d = 1 To myAppointment.Recipients.count 
 Debug.Print myAppointment.Recipients.item(d).name 
 Debug.Print myAppointment.Recipients.item(d).Type 
 Set myPA = myAppointment.Recipients.item(d).PropertyAccessor 
 myInt = myPA.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x39050003") 
 Debug.Print myInt 
 Debug.Print "---" 
 Next d 
End Sub
© www.soinside.com 2019 - 2024. All rights reserved.