2015-07-13 62 views
0

我正在开发一个Outlook 2013加载项,其中必须尽快将展现通讯组(可以嵌套也可以不嵌套)分配到其组成成员的名称中组从Outlook地址簿中选择。如何实现? 我完全是新手,从此以后没有提到源代码。任何帮助将不胜感激。在Outlook中使用c检索嵌套通讯组的成员

回答

0

我建议从Getting Started with VBA in Outlook 2010 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); 
      } 
     } 
    } 
} 

查看How to: Get Members of an Exchange Distribution List了解更多信息。

您可能会发现MSDN中的How Do I... (Outlook 2013 PIA Reference)部分有帮助。