public IEnumerable <ADRecipient> ResolveLegacyDNs(IEnumerable <string> legacyDNs)
 {
     if (legacyDNs != null && legacyDNs.Any <string>())
     {
         IRecipientSession recipientSession = (IRecipientSession)this.CreateAdSession();
         return(from recipient in recipientSession.FindADRecipientsByLegacyExchangeDNs(legacyDNs.ToArray <string>())
                where recipient.Data != null
                select recipient.Data);
     }
     return(null);
 }
Exemple #2
0
        private static Dictionary <string, ADRecipient> FindByLegacyExchangeDNs(string[] legacyExchangeDNs, UserContext userContext)
        {
            Dictionary <string, ADRecipient> dictionary = new Dictionary <string, ADRecipient>(StringComparer.OrdinalIgnoreCase);

            if (legacyExchangeDNs.Length > 0)
            {
                IRecipientSession      recipientSession = Utilities.CreateADRecipientSession(ConsistencyMode.IgnoreInvalid, userContext);
                Result <ADRecipient>[] array            = recipientSession.FindADRecipientsByLegacyExchangeDNs(legacyExchangeDNs);
                for (int i = 0; i < array.Length; i++)
                {
                    if (array[i].Data != null)
                    {
                        dictionary[legacyExchangeDNs[i]] = array[i].Data;
                    }
                }
            }
            return(dictionary);
        }