Esempio n. 1
0
 internal ADParticipantEntryId TryGetParticipantEntryId(byte[] memberEntryId)
 {
     if (memberEntryId != null)
     {
         return(ParticipantEntryId.TryFromEntryId(memberEntryId) as ADParticipantEntryId);
     }
     return(null);
 }
Esempio n. 2
0
 private static ParticipantEntryId[] ParseEntryIds(byte[][] entryIds)
 {
     ParticipantEntryId[] array = new ParticipantEntryId[entryIds.Length];
     for (int i = 0; i < entryIds.Length; i++)
     {
         array[i] = ParticipantEntryId.TryFromEntryId(entryIds[i]);
     }
     return(array);
 }
Esempio n. 3
0
        public static ParticipantEntryId TryFromEntryId(byte[] bytes)
        {
            if (bytes == null)
            {
                throw new ArgumentNullException("bytes");
            }
            ParticipantEntryId result;

            using (ParticipantEntryId.Reader reader = new ParticipantEntryId.Reader(bytes))
            {
                result = ParticipantEntryId.TryFromEntryId(reader);
            }
            return(result);
        }
Esempio n. 4
0
 protected bool Get(PropertyBag.BasicPropertyStore propertyBag, Participant.Builder participantBuilder)
 {
     byte[] valueOrDefault = propertyBag.GetValueOrDefault <byte[]>(this.entryIdPropDef);
     if (valueOrDefault != null)
     {
         participantBuilder.SetPropertiesFrom(ParticipantEntryId.TryFromEntryId(valueOrDefault));
     }
     participantBuilder.DisplayName  = propertyBag.GetValueOrDefault <string>(this.displayNamePropDef, participantBuilder.DisplayName);
     participantBuilder.EmailAddress = propertyBag.GetValueOrDefault <string>(this.emailAddressPropDef, participantBuilder.EmailAddress);
     participantBuilder.RoutingType  = propertyBag.GetValueOrDefault <string>(this.routingTypePropDef, participantBuilder.RoutingType);
     if (this.smtpAddressPropDef != null)
     {
         string valueOrDefault2 = propertyBag.GetValueOrDefault <string>(this.smtpAddressPropDef);
         if (!string.IsNullOrEmpty(valueOrDefault2))
         {
             participantBuilder[ParticipantSchema.SmtpAddress] = valueOrDefault2;
         }
     }
     if (this.sipUriPropDef != null)
     {
         string valueOrDefault3 = propertyBag.GetValueOrDefault <string>(this.sipUriPropDef);
         if (!string.IsNullOrEmpty(valueOrDefault3))
         {
             participantBuilder[ParticipantSchema.SipUri] = valueOrDefault3;
         }
     }
     if (this.sidPropDef != null)
     {
         byte[] valueOrDefault4 = propertyBag.GetValueOrDefault <byte[]>(this.sidPropDef);
         if (valueOrDefault4 != null)
         {
             participantBuilder[ParticipantSchema.ParticipantSID] = valueOrDefault4;
         }
     }
     if (this.guidPropDef != null)
     {
         byte[] valueOrDefault5 = propertyBag.GetValueOrDefault <byte[]>(this.guidPropDef);
         if (valueOrDefault5 != null)
         {
             participantBuilder[ParticipantSchema.ParticipantGuid] = valueOrDefault5;
         }
     }
     return(!string.IsNullOrEmpty(participantBuilder.DisplayName) || !string.IsNullOrEmpty(participantBuilder.EmailAddress));
 }
Esempio n. 5
0
        private static IList <ParticipantEntryId> FromFlatEntryList(ParticipantEntryId.Reader reader)
        {
            int num = reader.ReadInt32();

            reader.ReadInt32();
            IList <ParticipantEntryId> list = new List <ParticipantEntryId>();

            for (int i = 0; i < num; i++)
            {
                int num2 = reader.ReadInt32();
                list.Add(ParticipantEntryId.TryFromEntryId(reader.TearNext(num2)));
                if (reader.BytesRemaining != 0)
                {
                    reader.ReadPadding(num2, 4);
                }
            }
            reader.EnsureEnd();
            return(list);
        }
Esempio n. 6
0
        protected override object InternalTryGetValue(PropertyBag.BasicPropertyStore propertyBag)
        {
            Participant.Builder builder = new Participant.Builder();
            byte[] valueOrDefault       = propertyBag.GetValueOrDefault <byte[]>(InternalSchema.EntryId);
            if (valueOrDefault != null)
            {
                builder.SetPropertiesFrom(ParticipantEntryId.TryFromEntryId(valueOrDefault));
            }
            builder.DisplayName = (propertyBag.GetValueOrDefault <string>(InternalSchema.TransmitableDisplayName) ?? builder.DisplayName);
            if (!base.Get(propertyBag, builder))
            {
                return(new PropertyError(this, PropertyErrorCode.NotFound));
            }
            RecipientDisplayType?valueAsNullable = propertyBag.GetValueAsNullable <RecipientDisplayType>(InternalSchema.DisplayTypeExInternal);

            if (valueAsNullable != null)
            {
                builder[ParticipantSchema.DisplayTypeEx] = valueAsNullable.Value;
                builder.Origin = (builder.Origin ?? new DirectoryParticipantOrigin());
            }
            else if (PropertyError.IsPropertyNotFound(builder.TryGetProperty(ParticipantSchema.DisplayType)))
            {
                LegacyRecipientDisplayType?valueAsNullable2 = propertyBag.GetValueAsNullable <LegacyRecipientDisplayType>(InternalSchema.DisplayType);
                ObjectType?valueAsNullable3 = propertyBag.GetValueAsNullable <ObjectType>(InternalSchema.ObjectType);
                if (valueAsNullable2 != null)
                {
                    if (valueAsNullable2 != LegacyRecipientDisplayType.MailUser)
                    {
                        builder[ParticipantSchema.DisplayType] = (int)valueAsNullable2.Value;
                    }
                }
                else if (valueAsNullable3 != null && valueAsNullable3 == ObjectType.MAPI_DISTLIST)
                {
                    builder[ParticipantSchema.DisplayType] = 1;
                }
            }
            builder.SetOrDeleteProperty(ParticipantSchema.SendRichInfo, Util.NullIf <object>(propertyBag.GetValueAsNullable <bool>(InternalSchema.SendRichInfo), false));
            builder.SetOrDeleteProperty(ParticipantSchema.SendInternetEncoding, propertyBag.GetValueAsNullable <int>(InternalSchema.SendInternetEncoding));
            return(builder.ToParticipant());
        }