【问题标题】:Getting the representative email address of a distribution list获取分发列表的代表电子邮件地址
【发布时间】:2019-04-25 15:52:11
【问题描述】:

如何获取分发列表的代表电子邮件地址(不是列表中每个成员的电子邮件地址)? 请参考以下伪代码。

您的帮助将不胜感激。

Dim Recip As Outlook.Recipient
Dim Recip_email As String

If Recip.AddressEntry.AddressEntryUserType = olExchangeUserAddressEntry Then
    Recip_email = Recip.AddressEntry.GetExchangeUser.PrimarySmtpAddress
ElseIf Recip.AddressEntry.AddressEntryUserType = olSmtpAddressEntry Then
    Recip_email = Recip.Address
ElseIf Recip.AddressEntry.AddressEntryUserType = olExchangeDistributionListAddressEntry Then
    ' Recip that is a distribution list seems to fall in this branch
    ' How do I get the representative email address of the group?
    ' Example: if the representing email address is aaa@aaa.com, Recip_email = aaa@aaa.com

    Recip_email = ??????????????????????

Else
    Recip_email = vbNullString
End If

【问题讨论】:

  • “分发列表的代表电子邮件地址”是什么意思。 DL 本身的地址?
  • 是的,DL 本身的电子邮件地址。 DL 有一个分配给它的电子邮件地址,就像一个常规的 SMTP 地址一样。 Recip_email 是一个 SMTP 地址。参考代码中的 Recip_email。
  • 你检查过这个链接吗:stackoverflow.com/questions/10637729/…

标签: vba list email outlook contacts


【解决方案1】:

使用Recip.AddressEntry.GetExchangeDistributionList.PrimarySmtpAddress

【讨论】:

  • 这并没有提供问题的答案。要批评或要求作者澄清,请在他们的帖子下方留下评论。 - From Review
  • @user347383 这确实提供了答案。
  • Dmitry@ 谢谢你,它工作正常。但是,您的代码中似乎存在语法错误:Recip.AddressEntry.GetExchangeDistributionList.PrimarySmtpAddress
  • @Barok - 是的,抱歉,我已经确定了答案。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-09-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-02-06
  • 2017-12-11
相关资源
最近更新 更多