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); } } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)