Exemple #1
0
 public static byte[] SearchKeyFromParticipant(Participant participant)
 {
     if (null == participant)
     {
         return(null);
     }
     return(RuleUtil.SearchKeyFromAddress(participant.RoutingType, participant.EmailAddress));
 }
        private void SetDelegateProperties(MessageItem newMessage)
        {
            newMessage[ItemSchema.DelegatedByRule] = true;
            if (newMessage.GetValueOrDefault <object>(MessageItemSchema.ReceivedRepresentingEntryId, null) != null)
            {
                base.Context.TraceFunction("Delegate action: Message already has received-representing property.");
                return;
            }
            Result <ADRawEntry> result = base.Context.RecipientCache.FindAndCacheRecipient(base.Context.Recipient);
            ADRawEntry          data   = result.Data;

            if (data == null)
            {
                base.Context.TraceFunction <ProviderError>("Delegate action: Unable to read recipient data from AD: {0}", result.Error);
                return;
            }
            base.Context.TraceFunction("Delegate action: Setting received-representing properties.");
            newMessage[MessageItemSchema.ReceivedRepresentingDisplayName]  = data[ADRecipientSchema.DisplayName];
            newMessage[MessageItemSchema.ReceivedRepresentingAddressType]  = "EX";
            newMessage[MessageItemSchema.ReceivedRepresentingEmailAddress] = data[ADRecipientSchema.LegacyExchangeDN];
            newMessage[MessageItemSchema.ReceivedRepresentingSmtpAddress]  = data[ADRecipientSchema.PrimarySmtpAddress].ToString();
            newMessage[MessageItemSchema.ReceivedRepresentingSearchKey]    = RuleUtil.SearchKeyFromAddress("EX", (string)data[ADRecipientSchema.LegacyExchangeDN]);
            newMessage[MessageItemSchema.ReceivedRepresentingEntryId]      = base.Context.StoreSession.Mailbox[StoreObjectSchema.EntryId];
        }