使用c检索outlook中嵌套通讯组的成员#

使用c检索outlook中嵌套通讯组的成员#,outlook,add-in,Outlook,Add In,我正在开发Outlook 2013外接程序,在该外接程序中,一旦从Outlook通讯簿中选择通讯组,我就必须将通讯组(可能嵌套,也可能不嵌套)扩展到其组成成员的名称中。如何实现这一点? 我在这方面完全是新手,从今以后没有提到任何源代码。任何帮助都将不胜感激。我建议从MSDN中的文章开始 private void GetDistributionListMembers() { Outlook.SelectNamesDialog snd = Application.Session.

我正在开发Outlook 2013外接程序,在该外接程序中,一旦从Outlook通讯簿中选择通讯组,我就必须将通讯组(可能嵌套,也可能不嵌套)扩展到其组成成员的名称中。如何实现这一点?
我在这方面完全是新手,从今以后没有提到任何源代码。任何帮助都将不胜感激。

我建议从MSDN中的文章开始

private void GetDistributionListMembers()
{
    Outlook.SelectNamesDialog snd =
      Application.Session.GetSelectNamesDialog();
    Outlook.AddressLists addrLists =
      Application.Session.AddressLists;
    foreach (Outlook.AddressList addrList in addrLists)
    {
       if (addrList.Name == "All Groups")
       {
          snd.InitialAddressList = addrList;
          break;
       }
    }
    snd.NumberOfRecipientSelectors =
      Outlook.OlRecipientSelectors.olShowTo;
    snd.ToLabel = "D/L";
    snd.ShowOnlyInitialAddressList = true;
    snd.AllowMultipleSelection = false;
    snd.Display();
    if (snd.Recipients.Count > 0)
    {
       Outlook.AddressEntry addrEntry =
         snd.Recipients[1].AddressEntry;
       if (addrEntry.AddressEntryUserType ==
         Outlook.OlAddressEntryUserType.
           olExchangeDistributionListAddressEntry)
       {
           Outlook.ExchangeDistributionList exchDL =
             addrEntry.GetExchangeDistributionList();
           Outlook.AddressEntries addrEntries =
             exchDL.GetExchangeDistributionListMembers();
           if (addrEntries != null)
               foreach (Outlook.AddressEntry exchDLMember in addrEntries)
           {
               Debug.WriteLine(exchDLMember.Name);
           }
       }
   }
}
有关更多信息,请参阅

您可能会发现MSDN中的部分很有帮助