Exemple #1
0
 internal StoreParticipantEntryId(ParticipantEntryId.WabEntryFlag flags, ParticipantEntryId.Reader reader)
 {
     EnumValidator.AssertValid <ParticipantEntryId.WabEntryFlag>(flags);
     this.isMapiPDL         = StoreParticipantEntryId.WabEntryFlagToMapiPDL(flags);
     this.emailAddressIndex = StoreParticipantEntryId.WabEntryFlagToEmailAddressIndex(flags);
     this.ltEntryId         = reader.ReadLTEntryId();
     this.useWabFormat      = true;
     reader.EnsureEnd();
 }
Exemple #2
0
 protected override void Serialize(ParticipantEntryId.Writer writer)
 {
     if (this.useWabFormat)
     {
         writer.WriteEntryHeader(ParticipantEntryId.WabProviderGuid);
         writer.Write((byte)(StoreParticipantEntryId.ToWabEntryFlag(this.emailAddressIndex, this.isMapiPDL) | ParticipantEntryId.WabEntryFlag.Outlook));
         writer.Write(this.ltEntryId);
         return;
     }
     writer.WriteEntryHeader(ParticipantEntryId.OlabProviderGuid);
     writer.Write(3U);
     writer.Write(this.isMapiPDL ? 5U : 4U);
     writer.Write(StoreParticipantEntryId.EmailAddressIndexToIndex(this.emailAddressIndex));
     writer.Write(70);
     writer.Write(this.ltEntryId);
 }
Exemple #3
0
        internal StoreParticipantEntryId(ParticipantEntryId.Reader reader)
        {
            uint num = reader.ReadUInt32();

            if (num != 3U)
            {
                throw new NotSupportedException(ServerStrings.ExUnsupportedABProvider("OLABP", num.ToString()));
            }
            uint num2 = reader.ReadUInt32();

            this.isMapiPDL         = (num2 == 5U);
            this.emailAddressIndex = StoreParticipantEntryId.IndexToEmailAddressIndex(reader.ReadUInt32());
            if (reader.ReadUInt32() != 70U)
            {
                throw new NotSupportedException(ServerStrings.ExInvalidParticipantEntryId);
            }
            this.ltEntryId = reader.ReadLTEntryId();
            if (reader.BytesRemaining != 3)
            {
                reader.EnsureEnd();
            }
        }
        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
            });
        }
Exemple #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;
        }