Microsoft.Office.Interop.Outlook.SelectNames对话框获取电子邮件组

Microsoft.Office.Interop.Outlook.SelectNames对话框获取电子邮件组,outlook,mapi,Outlook,Mapi,目前我正在使用OutlookMicrosoft.Office.Interop.Outlook.SelectNamesDialog来获取联系人,但是在通讯簿中(Microsoft.Office.Interop.Outlook.SelectNamesDialog)也有群电子邮件 我正在寻找一种方法来获取该电子邮件组中的所有电子邮件 以下是如何通过选择从Exchange通讯组列表中检索成员的示例 Outlook.SelectNamesDialog name=Globals.ThisAddIn.Appl

目前我正在使用Outlook
Microsoft.Office.Interop.Outlook.SelectNamesDialog
来获取联系人,但是在通讯簿中(
Microsoft.Office.Interop.Outlook.SelectNamesDialog
)也有群电子邮件


我正在寻找一种方法来获取该电子邮件组中的所有电子邮件

以下是如何通过选择从Exchange通讯组列表中检索成员的示例

Outlook.SelectNamesDialog name=Globals.ThisAddIn.Application.Session.GetSelectNamesDialog();
names.SetDefaultDisplayMode(Outlook.OlDefaultSelectNamesDisplayMode.olDefaultMembers);
names.ForceResolution=true;
name.Caption=“请选择某物”;
if(name.Display())
{
Outlook.Recipients=name.Recipients;
foreach(收件人中的Outlook.Recipient)
{
Outlook.AddressEntry=recipient.AddressEntry;
if(entry.AddressEntryUserType==Outlook.OlAddressEntryUserType.olExchangeDistributionListAddressEntry)
{
Outlook.ExchangeDistributionList=entry.GetExchangeDistributionList();
Outlook.AddressEntries members=list.GetExchangeDistributionListMembers();
foreach(成员中的Outlook.AddressEntry成员)
{
Outlook.ExchangeUser=member.GetExchangeUser();
字符串地址=user.PrimarySmtpAddress;
}
}
}
}

一旦您有了地址,就可以很容易地将其添加到集合中。

对于联系人文件夹中的通讯组列表,前面的回答将失败。
您只需访问Recipient.AddressEntry.Members集合(准备好处理空值)。

当前我要做的是从Microsoft.Office.Interop.Outlook获取Recipients列表。选择NamesDialog作为返回类型,并循环访问每个收件人以访问每个once属性。但收件人对象不包含.AddressEntry.Members。你能澄清一下吗:)OOM中的收件人对象确实包含AddressEntry属性。并且AddressEntry对象包含Members属性。感谢您的回复。我得到了SliverNinja提到的完整解决方案。干杯:)这就是确切的解决方案,效果很好。谢谢你的帮助,银忍者干杯