private void ParseMapiProperties() { base.Clear(); if (this.blob != null) { IList <ParticipantEntryId> list; try { list = ParticipantEntryId.FromFlatEntryList(this.blob); } catch (CorruptDataException) { this.isCorrectionNeeded = true; throw; } string[] array = null; if (this.names != null) { array = this.names.Split(new char[] { ';' }); if (array.Length != list.Count) { array = null; } } int num = 0; foreach (ParticipantEntryId participantEntryId in list) { Participant.Builder builder = new Participant.Builder(); string text = null; if (array != null) { text = array[num].Trim(); } num++; if (participantEntryId is OneOffParticipantEntryId || participantEntryId is ADParticipantEntryId) { builder.SetPropertiesFrom(participantEntryId); } else { this.isCorrectionNeeded = true; if (text == null) { continue; } builder.EmailAddress = text; builder.RoutingType = "SMTP"; } if (text != null) { builder.DisplayName = text; } base.Items.Add(builder.ToParticipant()); } } this.isListChanged = false; }
private static ProxyAddress GetLegacyProxyAddress(IRuleEvaluationContext context, byte[] entryId) { if (entryId.Length == 0) { context.TraceDebug("GetLegacyProxyAddress: entry ID is zero-length"); return(null); } ParticipantEntryId participantEntryId = ParticipantEntryId.TryFromEntryId(entryId); context.TraceDebug <string>("GetLegacyProxyAddress: entry ID is {0}", participantEntryId.GetType().Name); Participant.Builder builder = new Participant.Builder(); builder.SetPropertiesFrom(participantEntryId); Participant participant = builder.ToParticipant(); string routingType = participant.RoutingType; string emailAddress = participant.EmailAddress; if (routingType != "EX" || string.IsNullOrEmpty(emailAddress)) { context.TraceDebug <string, string>("GetLegacyProxyAddress: returning null, address is {0}:{1}", routingType ?? "(null)", emailAddress ?? "(null)"); return(null); } ProxyAddress proxyAddress = ProxyAddress.Parse(routingType, emailAddress); if (proxyAddress is InvalidProxyAddress) { context.TraceDebug <string>("GetLegacyProxyAddress: legacyDN {0} is not valid", emailAddress); return(null); } context.TraceDebug <string>("GetLegacyProxyAddress: returning EX:{0}", emailAddress); return(proxyAddress); }
internal static Participant GetParticipant(byte[] entryId) { ParticipantEntryId participantEntryId = ParticipantEntryId.TryFromEntryId(entryId); if (participantEntryId is UnrecognizedParticipantEntryId) { return(null); } Participant.Builder builder = new Participant.Builder(); builder.SetPropertiesFrom(participantEntryId); return(builder.ToParticipant()); }
private static string LegDNFromParticipantEntryId(byte[] entryId) { if (entryId == null || entryId.Length == 0) { return(null); } ADParticipantEntryId adparticipantEntryId = ParticipantEntryId.TryFromEntryId(entryId) as ADParticipantEntryId; if (adparticipantEntryId != null) { Participant.Builder builder = new Participant.Builder(); builder.SetPropertiesFrom(adparticipantEntryId); return(builder.ToParticipant().EmailAddress); } return(null); }
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)); }
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()); }
private static byte[] ParticipanEntryIdFromLegDN(byte[] originalEntryId, string newLegDN) { if (originalEntryId == null || originalEntryId.Length == 0) { return(null); } ADParticipantEntryId adparticipantEntryId = ParticipantEntryId.TryFromEntryId(originalEntryId) as ADParticipantEntryId; if (adparticipantEntryId == null) { return(null); } Participant.Builder builder = new Participant.Builder(); builder.SetPropertiesFrom(adparticipantEntryId); builder.EmailAddress = newLegDN; ParticipantEntryId participantEntryId = ParticipantEntryId.FromParticipant(builder.ToParticipant(), ParticipantEntryIdConsumer.RecipientTableSecondary); if (participantEntryId == null) { return(null); } return(participantEntryId.ToByteArray()); }
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 }); }