Пример #1
0
        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);
        }
Пример #2
0
        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());
        }
Пример #3
0
        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);
        }
Пример #4
0
        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());
        }