Пример #1
0
        private void SetFakeEntryInLegacyPDL()
        {
            string             text = "Unknown";
            ParticipantEntryId participantEntryId = new OneOffParticipantEntryId(ClientStrings.LegacyPDLFakeEntry, text, text);

            byte[][] value = DistributionList.EncodeEntryIds(new ParticipantEntryId[]
            {
                participantEntryId
            });
            this[DistributionListSchema.Members]       = value;
            this[DistributionListSchema.OneOffMembers] = value;
        }
Пример #2
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");
                    }
                }
            }
        }
        internal DistributionListMember(DistributionList distributionList, ParticipantEntryId mainEntryId, OneOffParticipantEntryId oneOffEntryId)
        {
            this.distributionList = distributionList;
            this.memberStatus     = MemberStatus.Normal;
            Participant.Builder  builder = new Participant.Builder();
            ADParticipantEntryId adparticipantEntryId = mainEntryId as ADParticipantEntryId;

            if (adparticipantEntryId != null)
            {
                builder.SetPropertiesFrom(adparticipantEntryId);
                if (oneOffEntryId != null)
                {
                    builder.DisplayName = oneOffEntryId.EmailDisplayName;
                    if (!string.IsNullOrEmpty(oneOffEntryId.EmailAddress) && Participant.RoutingTypeEquals(oneOffEntryId.EmailAddressType, "SMTP"))
                    {
                        builder[ParticipantSchema.SmtpAddress] = oneOffEntryId.EmailAddress;
                    }
                }
                this.participant = builder.ToParticipant();
            }
            else
            {
                StoreParticipantEntryId storeParticipantEntryId = mainEntryId as StoreParticipantEntryId;
                if (storeParticipantEntryId != null && oneOffEntryId != null)
                {
                    builder.SetPropertiesFrom(oneOffEntryId);
                    builder.SetPropertiesFrom(storeParticipantEntryId);
                    this.participant = builder.ToParticipant();
                }
                else
                {
                    OneOffParticipantEntryId oneOffParticipantEntryId = mainEntryId as OneOffParticipantEntryId;
                    if (oneOffParticipantEntryId == null)
                    {
                        oneOffParticipantEntryId = oneOffEntryId;
                        this.memberStatus        = MemberStatus.Demoted;
                    }
                    if (oneOffParticipantEntryId != null)
                    {
                        builder.SetPropertiesFrom(oneOffParticipantEntryId);
                        this.participant = builder.ToParticipant();
                    }
                    else
                    {
                        this.memberStatus = MemberStatus.Unrecognized;
                    }
                }
            }
            if (this.mainEntryId == null)
            {
                this.mainEntryId = mainEntryId;
            }
            if (this.oneOffEntryId == null)
            {
                this.oneOffEntryId = oneOffEntryId;
            }
            ExTraceGlobals.StorageTracer.Information((long)this.GetHashCode(), "Loaded a {1} DL member \"{0}\". MainEntryId=\"{2}\", OneOffEntryId=\"{3}\"", new object[]
            {
                this.participant,
                this.memberStatus,
                this.mainEntryId,
                this.oneOffEntryId
            });
        }
 internal DistributionListMember(DistributionList distributionList, ParticipantEntryId mainEntryId, OneOffParticipantEntryId oneOffEntryId, byte[] extraBytes) : this(distributionList, mainEntryId, oneOffEntryId)
 {
     if (extraBytes != null)
     {
         this.extraBytes = extraBytes;
     }
 }
Пример #5
0
        private void PreprocessEntryIds(ParticipantEntryId[] mainEntryIds, ref ParticipantEntryId[] oneOffEntryIds)
        {
            OneOffParticipantEntryId[] array = new OneOffParticipantEntryId[mainEntryIds.Length];
            if (!this.ChecksumIsCurrent())
            {
                int i = 0;
                while (i < mainEntryIds.Length)
                {
                    StoreParticipantEntryId  storeParticipantEntryId  = mainEntryIds[i] as StoreParticipantEntryId;
                    OneOffParticipantEntryId oneOffParticipantEntryId = mainEntryIds[i] as OneOffParticipantEntryId;
                    if (storeParticipantEntryId != null)
                    {
                        try
                        {
                            using (Item item = Microsoft.Exchange.Data.Storage.Item.Bind(base.Session, storeParticipantEntryId.ToUniqueItemId(), ContactSchema.Instance.AutoloadProperties))
                            {
                                Contact          contact          = item as Contact;
                                DistributionList distributionList = item as DistributionList;
                                if (contact != null)
                                {
                                    Participant participant = contact.EmailAddresses[storeParticipantEntryId.EmailAddressIndex];
                                    if (participant != null)
                                    {
                                        Participant participant2 = new Participant(contact.DisplayName, participant.EmailAddress, participant.RoutingType, participant.Origin, Array <PropValue> .Empty);
                                        array[i] = (OneOffParticipantEntryId)ParticipantEntryId.FromParticipant(participant2, ParticipantEntryIdConsumer.SupportsNone);
                                    }
                                }
                                else if (distributionList != null)
                                {
                                    array[i] = (OneOffParticipantEntryId)ParticipantEntryId.FromParticipant(distributionList.GetAsParticipant(), ParticipantEntryIdConsumer.SupportsNone);
                                }
                            }
                            goto IL_F1;
                        }
                        catch (ObjectNotFoundException)
                        {
                            goto IL_F1;
                        }
                        goto IL_EA;
                    }
                    goto IL_EA;
IL_F1:
                    i++;
                    continue;
IL_EA:
                    if (oneOffParticipantEntryId != null)
                    {
                        array[i] = oneOffParticipantEntryId;
                        goto IL_F1;
                    }
                    goto IL_F1;
                }
            }
            else
            {
                for (int j = 0; j < mainEntryIds.Length; j++)
                {
                    array[j] = (oneOffEntryIds[j] as OneOffParticipantEntryId);
                }
            }
            OneOffParticipantEntryId[] array2 = (OneOffParticipantEntryId[])array.Clone();
            this.NormalizeADEntryIds(mainEntryIds, array2);
            bool flag = oneOffEntryIds.Length == array.Length;
            int  num  = 0;

            while (flag && num < oneOffEntryIds.Length)
            {
                OneOffParticipantEntryId oneOffParticipantEntryId2 = oneOffEntryIds[num] as OneOffParticipantEntryId;
                if (oneOffParticipantEntryId2 == null)
                {
                    flag = false;
                }
                else if (array2[num] != null)
                {
                    flag = ParticipantComparer.EmailAddressIgnoringRoutingType.Equals(array2[num].ToParticipant(), oneOffParticipantEntryId2.ToParticipant());
                }
                num++;
            }
            for (int k = 0; k < array.Length; k++)
            {
                if (array[k] == null)
                {
                    if (array2[k] != null)
                    {
                        array[k] = array2[k];
                    }
                    else if (flag)
                    {
                        array[k] = (OneOffParticipantEntryId)oneOffEntryIds[k];
                    }
                }
            }
            oneOffEntryIds = array;
        }