protected override void InternalSetValue(PropertyBag.BasicPropertyStore propertyBag, object value)
        {
            Participant        participant        = (Participant)value;
            ParticipantEntryId participantEntryId = ParticipantEntryId.FromParticipant(participant, ParticipantEntryIdConsumer.ContactEmailSlot);

            propertyBag.SetValueWithFixup(base.DisplayNamePropertyDefinition, participant.DisplayName ?? string.Empty);
            propertyBag.SetValueWithFixup(base.EmailAddressPropertyDefinition, participant.EmailAddress ?? string.Empty);
            propertyBag.SetValueWithFixup(base.RoutingTypePropertyDefinition, participant.RoutingType ?? string.Empty);
            if (this.emailAddressForDisplayPropDef != null)
            {
                AtomicStorePropertyDefinition propertyDefinition = this.emailAddressForDisplayPropDef;
                string propertyValue;
                if ((propertyValue = participant.GetValueOrDefault <string>(ParticipantSchema.EmailAddressForDisplay)) == null)
                {
                    propertyValue = (participant.EmailAddress ?? string.Empty);
                }
                propertyBag.SetValueWithFixup(propertyDefinition, propertyValue);
            }
            if (participantEntryId != null)
            {
                propertyBag.SetValueWithFixup(base.EntryIdPropertyDefinition, participantEntryId.ToByteArray());
                return;
            }
            propertyBag.Delete(base.EntryIdPropertyDefinition);
        }
Esempio n. 2
0
        protected override void InternalSetValue(PropertyBag.BasicPropertyStore propertyBag, object value)
        {
            Participant        participant        = (Participant)value;
            ParticipantEntryId participantEntryId = ParticipantEntryId.FromParticipant(participant, this.entryIdConsumer);

            propertyBag.Update(this.displayNamePropDef, participant.DisplayName);
            propertyBag.Update(this.emailAddressPropDef, participant.EmailAddress);
            propertyBag.Update(this.routingTypePropDef, participant.RoutingType);
            propertyBag.Update(this.entryIdPropDef, (participantEntryId != null) ? participantEntryId.ToByteArray() : null);
            if (this.smtpAddressPropDef != null)
            {
                propertyBag.Update(this.smtpAddressPropDef, participant.TryGetProperty(ParticipantSchema.SmtpAddress));
            }
            if (this.sipUriPropDef != null)
            {
                propertyBag.Update(this.sipUriPropDef, participant.TryGetProperty(ParticipantSchema.SipUri));
            }
            if (this.sidPropDef != null)
            {
                propertyBag.Update(this.sidPropDef, participant.TryGetProperty(ParticipantSchema.ParticipantSID));
            }
            if (this.guidPropDef != null)
            {
                propertyBag.Update(this.guidPropDef, participant.TryGetProperty(ParticipantSchema.ParticipantGuid));
            }
        }
Esempio n. 3
0
 private void CalculateMapiProperties()
 {
     if (!this.isListChanged && !this.isCorrectionNeeded)
     {
         return;
     }
     if (base.Count == 0)
     {
         this.names = null;
         this.blob  = null;
     }
     else
     {
         ParticipantEntryId[] array  = new ParticipantEntryId[base.Count];
         int           num           = 0;
         StringBuilder stringBuilder = new StringBuilder(base.Count * 16);
         foreach (Participant participant in this)
         {
             if (num != 0)
             {
                 stringBuilder.Append(';');
             }
             array[num++] = ParticipantEntryId.FromParticipant(participant, ParticipantEntryIdConsumer.SupportsADParticipantEntryId);
             stringBuilder.Append(participant.DisplayName);
         }
         this.blob  = ParticipantEntryId.ToFlatEntryList(array);
         this.names = stringBuilder.ToString();
     }
     this.isListChanged       = false;
     this.isCorrectionNeeded  = false;
     this.isPropertiesChanged = true;
 }
Esempio n. 4
0
        protected override void InternalSetValue(PropertyBag.BasicPropertyStore propertyBag, object value)
        {
            base.InternalSetValue(propertyBag, value);
            Participant        participant        = (Participant)value;
            ParticipantEntryId participantEntryId = ParticipantEntryId.FromParticipant(participant, ParticipantEntryIdConsumer.RecipientTablePrimary);

            if (participantEntryId != null)
            {
                propertyBag.SetValueWithFixup(InternalSchema.EntryId, participantEntryId.ToByteArray());
            }
            else
            {
                propertyBag.Delete(InternalSchema.EntryId);
            }
            RecipientDisplayType?      valueAsNullable  = participant.GetValueAsNullable <RecipientDisplayType>(ParticipantSchema.DisplayTypeEx);
            LegacyRecipientDisplayType?valueAsNullable2 = participant.GetValueAsNullable <LegacyRecipientDisplayType>(ParticipantSchema.DisplayType);

            if (participant.RoutingType != null)
            {
                propertyBag.Update(InternalSchema.TransmitableDisplayName, participant.DisplayName);
                if (valueAsNullable2 == null)
                {
                    valueAsNullable2 = new LegacyRecipientDisplayType?(LegacyRecipientDisplayType.MailUser);
                }
            }
            else
            {
                propertyBag.Delete(InternalSchema.TransmitableDisplayName);
            }
            AtomicStorePropertyDefinition displayTypeExInternal = InternalSchema.DisplayTypeExInternal;
            RecipientDisplayType?         recipientDisplayType  = valueAsNullable;

            propertyBag.Update(displayTypeExInternal, (recipientDisplayType != null) ? new int?((int)recipientDisplayType.GetValueOrDefault()) : null);
            AtomicStorePropertyDefinition displayType = InternalSchema.DisplayType;
            LegacyRecipientDisplayType?   legacyRecipientDisplayType = valueAsNullable2;

            propertyBag.Update(displayType, (legacyRecipientDisplayType != null) ? new int?((int)legacyRecipientDisplayType.GetValueOrDefault()) : null);
            if (valueAsNullable2 != null)
            {
                if (valueAsNullable2 == LegacyRecipientDisplayType.DistributionList || valueAsNullable2 == LegacyRecipientDisplayType.PersonalDistributionList)
                {
                    propertyBag.SetValueWithFixup(InternalSchema.ObjectType, 8);
                }
                else
                {
                    propertyBag.SetValueWithFixup(InternalSchema.ObjectType, 6);
                }
            }
            else
            {
                propertyBag.Delete(InternalSchema.ObjectType);
            }
            propertyBag.SetValueWithFixup(InternalSchema.SendRichInfo, participant.GetValueOrDefault <bool>(ParticipantSchema.SendRichInfo));
            propertyBag.Update(InternalSchema.SendInternetEncoding, participant.GetValueAsNullable <int>(ParticipantSchema.SendInternetEncoding));
        }
 internal DistributionListMember(DistributionList distributionList, Participant participant)
 {
     if (participant == null)
     {
         throw new ArgumentNullException("participant");
     }
     this.distributionList = distributionList;
     this.participant      = participant;
     this.memberStatus     = MemberStatus.Normal;
     this.mainEntryId      = ParticipantEntryId.FromParticipant(participant, ParticipantEntryIdConsumer.DLMemberList);
     if (this.mainEntryId == null)
     {
         throw new InvalidParticipantException(ServerStrings.ExOperationNotSupportedForRoutingType("DistributionList.Add", participant.RoutingType), ParticipantValidationStatus.OperationNotSupportedForRoutingType);
     }
 }
Esempio n. 6
0
 private void AddPermissionEntriesForAddOrModify(MapiAclTableAdapter mapiAclTableAdapter)
 {
     foreach (Permission permission in this.permissions.Values)
     {
         byte[] array = null;
         if (permission.Origin == PermissionOrigin.New)
         {
             if (permission.Principal.Type == PermissionSecurityPrincipal.SecurityPrincipalType.ADRecipientPrincipal)
             {
                 ParticipantEntryId participantEntryId = ParticipantEntryId.FromParticipant(new Participant(permission.Principal.ADRecipient), ParticipantEntryIdConsumer.SupportsADParticipantEntryId);
                 array = participantEntryId.ToByteArray();
             }
             else if (permission.Principal.Type == PermissionSecurityPrincipal.SecurityPrincipalType.ExternalUserPrincipal)
             {
                 ExternalUser externalUser = permission.Principal.ExternalUser;
                 byte[]       array2       = new byte[externalUser.Sid.BinaryLength];
                 externalUser.Sid.GetBinaryForm(array2, 0);
                 array = MapiStore.GetAddressBookEntryIdFromLocalDirectorySID(array2);
             }
             if (array != null)
             {
                 mapiAclTableAdapter.AddPermissionEntry(array, permission.MemberRights);
             }
         }
         else if (permission.IsDirty)
         {
             mapiAclTableAdapter.ModifyPermissionEntry(permission.MemberId, permission.MemberRights);
         }
     }
     if (this.anonymousMemberPermission != null && this.anonymousMemberPermission.IsDirty)
     {
         mapiAclTableAdapter.ModifyPermissionEntry(this.anonymousMemberPermission.MemberId, this.anonymousMemberPermission.MemberRights);
     }
     if (this.defaultMemberPermission != null && this.defaultMemberPermission.IsDirty)
     {
         mapiAclTableAdapter.ModifyPermissionEntry(this.defaultMemberPermission.MemberId, this.defaultMemberPermission.MemberRights);
     }
 }
Esempio n. 7
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;
        }