Пример #1
0
        private void NormalizeADEntryIds(ParticipantEntryId[] mainEntryIds, ParticipantEntryId[] oneOffEntryIds)
        {
            List <string> list  = new List <string>();
            List <int>    list2 = new List <int>();

            for (int i = 0; i < mainEntryIds.Length; i++)
            {
                ADParticipantEntryId     adparticipantEntryId     = mainEntryIds[i] as ADParticipantEntryId;
                OneOffParticipantEntryId oneOffParticipantEntryId = (OneOffParticipantEntryId)oneOffEntryIds[i];
                if (adparticipantEntryId != null && (oneOffParticipantEntryId == null || adparticipantEntryId.IsDL == null))
                {
                    list.Add(adparticipantEntryId.LegacyDN);
                    list2.Add(i);
                }
                else if (oneOffParticipantEntryId != null && oneOffParticipantEntryId.EmailAddressType == "EX")
                {
                    list.Add(oneOffParticipantEntryId.EmailAddress);
                    list2.Add(i);
                }
            }
            if (list.Count > 0)
            {
                object[][] array = DistributionList.LookupInAD(() => base.Session.GetADRecipientSession(true, ConsistencyMode.IgnoreInvalid), list, DistributionList.adLookupProperties);
                for (int j = 0; j < list.Count; j++)
                {
                    if (array[j] != null)
                    {
                        int num = list2[j];
                        if (mainEntryIds[num] is ADParticipantEntryId && mainEntryIds[num].IsDL == null)
                        {
                            bool flag = DistributionList.IsDL((RecipientType)array[j][2]);
                            mainEntryIds[num] = new ADParticipantEntryId(list[j], new LegacyRecipientDisplayType?(flag ? LegacyRecipientDisplayType.DistributionList : LegacyRecipientDisplayType.MailUser), true);
                        }
                        OneOffParticipantEntryId oneOffParticipantEntryId2 = oneOffEntryIds[num] as OneOffParticipantEntryId;
                        oneOffEntryIds[num] = new OneOffParticipantEntryId((oneOffParticipantEntryId2 != null) ? oneOffParticipantEntryId2.EmailDisplayName : ((string)array[j][0]), array[j][1].ToString(), "SMTP");
                    }
                }
            }
        }